The following code throws an EZDecompressionError with message 'Invalid ZStream operation' whenever the line
Reader.Free
is executed. Can someone tell me what's wrong with this code?
Reader := nil;
Decompressor := nil;
InputFile := TFileStream (FileName, fmOpenRead);
try
Decompressor := TDecompressionStream.Create (InputFile);
Reader := TReader.Create (Decompressor, 1024);
SomeString := Reader.ReadString;
finally
Reader.Free
Decompressor.Free;
InputFile.Free;
end;
I tested to change the order of the memory freeing commands but that doesn't seem to help. Leaving out the Reader.Free line of course results in a memory leak.