diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-11-13 09:27:11 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-11-13 15:11:09 +0000 |
commit | c1172f1ca324d0df54050a9b023acf35750467ee (patch) | |
tree | 6dc78c8149da9c724a49b58e21e082c7525d2d8f /src/corelib | |
parent | f555d77c67dd10e74d13346eb3d5bfd96b3efcc9 (diff) | |
download | fpGUI-c1172f1ca324d0df54050a9b023acf35750467ee.tar.xz |
Fixes a memory leak when reading a PNG image from a Stream.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/fpg_imgfmt_png.pas | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/fpg_imgfmt_png.pas b/src/corelib/fpg_imgfmt_png.pas index d0620672..c0659d2e 100644 --- a/src/corelib/fpg_imgfmt_png.pas +++ b/src/corelib/fpg_imgfmt_png.pas @@ -88,6 +88,7 @@ end; function LoadImage_PNG(AStream: TStream): TfpgImage; var imga: TFPMemoryImage; + reader: TFPReaderPNG; begin Result := nil; if AStream = nil then @@ -97,7 +98,8 @@ begin try try AStream.Position := 0; - imga.LoadFromStream(AStream, TFPReaderPNG.Create); // auto size image + reader := TFPReaderPNG.Create; + imga.LoadFromStream(AStream, reader); // auto size image Result := FPImageToFPG(imga); except on e: Exception do @@ -107,6 +109,7 @@ begin end; end; finally + reader.Free; imga.Free; end; end; |