Menu

#6 File handle leaked on SwfReader.Inflate()

open
nobody
None
5
2011-04-18
2011-04-18
Anonymous
No

The Inflate() method of SwfReader will leak a file handle when the BufferedBinaryReader is reinitialised from a MemoryStream (Line 268).

This can be fixed by closing the reader (add "br.close();") before re-assigning the variable.

In the Inflate method:

// ~Line 261
zipInflator.Inflate(uncompressed,8,size-8);

/* Start fix. */
// Close the handle before re-assigning to avoid a file handle leak:
br.Close();
/* End fix. */

// ~Line 268
// new memory stream for uncompressed swf
MemoryStream m = new MemoryStream(uncompressed);

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.