[Scummvm-tracker] [ScummVM] #10217: Possible memory leak for Image::writePNG

dafioram trac at scummvm.org
Wed Sep 20 17:19:52 CEST 2017


#10217: Possible memory leak for Image::writePNG
-----------------------+-----------------------
  Reporter:  dafioram  |      Owner:  (none)
      Type:  defect    |     Status:  new
  Priority:  low       |  Component:  --Other--
Resolution:            |   Keywords:
      Game:            |
-----------------------+-----------------------

Comment (by dafioram):

 I was originally thinking adding a
 {{{
 png_destroy_write_struct(&pngPtr, &endInfo);
 }}}
 after line 317 would make sense. But it looks like it may make the most
 sense to just remove:

 {{{
         png_infop endInfo = png_create_info_struct(pngPtr);
         if (!endInfo) {
                 png_destroy_write_struct(&pngPtr, &infoPtr);
                 return false;
         }
 }}}

 from Image::writePNG. I think the endInfo creation in writePNG is in there
 because it was copied from PNGDecoder::loadStream which uses endInfo as
 apart of png_destroy_read_struct(&pngPtr, &infoPtr, &endInfo); in line
 242. Since endInfo is not used in writePNG it can probably be removed.

--
Ticket URL: <https://bugs.scummvm.org/ticket/10217#comment:3>
ScummVM <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list