diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-07-31 09:54:08 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2013-07-31 09:54:08 +0100 |
commit | dc407afacff397482916e8ac860f937cfe0a84b6 (patch) | |
tree | 05ee1b4f9ea406e435ed7fd47b7b80848e468d08 /src/corelib | |
parent | b8851dc72a8d82e7b798fbbc9660cc5f9e8479ae (diff) | |
download | fpGUI-dc407afacff397482916e8ac860f937cfe0a84b6.tar.xz |
Fixes a memory leak in the LoadImage_PNG() function.
The PNG Reader Class was never freed. Thanks to Leonardo M. Ramé
for reporting this.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/fpg_imgfmt_png.pas | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/corelib/fpg_imgfmt_png.pas b/src/corelib/fpg_imgfmt_png.pas index c95150e4..d9683bbe 100644 --- a/src/corelib/fpg_imgfmt_png.pas +++ b/src/corelib/fpg_imgfmt_png.pas @@ -68,6 +68,7 @@ end; function LoadImage_PNG(const AFileName: TfpgString): TfpgImage; var imga: TFPCustomImage; + PNGReader: TFPReaderPNG; begin Result := nil; if not fpgFileExists(AFileName) then @@ -75,7 +76,12 @@ begin imga := TFPMemoryImage.Create(0, 0); try - imga.LoadFromFile(AFileName, TFPReaderPNG.Create); // auto size image + PNGReader := TFPReaderPNG.Create; + try + imga.LoadFromFile(AFileName, PNGReader); // auto size image + finally + PNGReader.Free; + end; except imga := nil; end; |