]> git.imager.perl.org - imager.git/commitdiff
- some error paths when reading GIF images weren't closing the GIF
authorTony Cook <tony@develop=help.com>
Tue, 7 Mar 2006 00:25:10 +0000 (00:25 +0000)
committerTony Cook <tony@develop=help.com>
Tue, 7 Mar 2006 00:25:10 +0000 (00:25 +0000)
  read object. (detected by valgrind)

Changes
gif.c

diff --git a/Changes b/Changes
index be88b798fcc1f28ec19ed7b3e6bef898c2cd9026..bc42d5d6e6d4a3e1dba214db6255ee07ac6a1f9e 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1391,6 +1391,8 @@ Revision history for Perl extension Imager.
   was leaking memory. (detected by valgrind)
 - writing to a PNG file was leaking one memory block
   (detected by valgrind)
+- some error paths when reading GIF images weren't closing the GIF
+  read object. (detected by valgrind)
 
 =================================================================
 
diff --git a/gif.c b/gif.c
index 3aa46d46f44c360c8ec609baebb15ba907541fef..191f24cfd23889a96f833b991d76271adaa202ab 100644 (file)
--- a/gif.c
+++ b/gif.c
@@ -586,12 +586,14 @@ i_img **i_readgif_multi_low(GifFileType *GifFile, int *count, int page) {
        if (!i_int_check_image_file_limits(Width, Height, channels, sizeof(i_sample_t))) {
          free_images(results, *count);
          mm_log((1, "i_readgif: image size exceeds limits\n"));
+         DGifCloseFile(GifFile);
          myfree(GifRow);
          return NULL;
        }
        img = i_img_pal_new(Width, Height, channels, 256);
        if (!img) {
          free_images(results, *count);
+         DGifCloseFile(GifFile);
          return NULL;
        }
        /* populate the palette of the new image */