#55 EGifPutImageDesc() memory leak

v1.0_(example)
closed
nobody
None
1
2014-03-24
2014-03-20
MikeGuz
No

1) Build a program based on gifsponge.c
2) Use the attached GIF file as an input
3) Run the program under valgrind with the following options:
valgrind --log-file=vg.log --leak-check=full ./gifsponge
4) Look at valgrind output

==17267== 5,544 (168 direct, 5,376 indirect) bytes in 7 blocks are definitely lost in loss record 6 of 9
==17267== at 0x4A078B8: malloc (vg_replace_malloc.c:270)
==17267== by 0x4C13056: GifMakeMapObject (gifalloc.c:50)
==17267== by 0x4C11FD5: EGifPutImageDesc (egif_lib.c:360)
==17267== by 0x4C12574: EGifSpew (egif_lib.c:1079)
==17267== by 0x400A07: main (gifsponge.c:72)
Full log file attached

Root cause: Memory in GifFile->Image.ColorMap is overwritten without being freed

2 Attachments

Discussion

  • MikeGuz
    MikeGuz
    2014-03-20

    Attached patch file fixes the leak

     
    Attachments
    • status: open --> closed
     
  • Patch merged, thanks.