Skip to content

In some extreme situations, like Exception raised in FlushFinalBlock call, the BaseStream remains open #228

@mpascalau

Description

@mpascalau

Hallo,
please pay attention on this piece of code as it may leave the BaseStream open ... in case that the FlushFinalBlock operation will raise an exception.

Instead of

				if (!_finalBlockTransformed)
				{
					FlushFinalBlock();
				}
				if (!_leaveOpen)
				{
					_stream.Close();
				}

is it not better if we change it to:

				try {
					if (!_finalBlockTransformed)
					{
						FlushFinalBlock();
					}
				} finally {
					if (!_leaveOpen)
					{
						_stream.Close();
					}
				}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions