Skip to content
Permalink
Browse files Browse the repository at this point in the history
coders/png.c: Stop a memory leak in read_user_chunk_callback() (refer…
…ence

#517).
  • Loading branch information
glennrp committed Jun 22, 2017
1 parent 72a50e4 commit 8ca3583
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
2017-06-10 7.0.6-0 Glenn Randers-Pehrson <glennrp@image...>
* Stop a memory leak in read_user_chunk_callback() (reference
https://github.com/ImageMagick/ImageMagick/issues/517).

2017-06-10 7.0.6-0 Cristy <quetzlzacatenango@image...>
* Release ImageMagick version 7.0.6-0, GIT revision 20194:b0c0d00:20170611.

Expand Down
4 changes: 4 additions & 0 deletions coders/png.c
Expand Up @@ -1904,6 +1904,7 @@ static int read_user_chunk_callback(png_struct *ping, png_unknown_chunkp chunk)
p[4] != '\0' || p[5] != '\0')
{
/* Chunk is malformed */
profile=DestroyStringInfo(profile);
return(-1);
}
}
Expand All @@ -1917,6 +1918,8 @@ static int read_user_chunk_callback(png_struct *ping, png_unknown_chunkp chunk)
(void) SetImageProfile(image,"exif",profile,
error_info->exception);

profile=DestroyStringInfo(profile);

return(1);
}

Expand Down Expand Up @@ -2290,6 +2293,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
/*
PNG image is corrupt.
*/
printf(" destroy_read_struct\n");

This comment has been minimized.

Copy link
@dlemstra

dlemstra Jun 23, 2017

Member

@glennrp Is this a debug printf that was left behind?

png_destroy_read_struct(&ping,&ping_info,&end_info);

#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
Expand Down

1 comment on commit 8ca3583

@glennrp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the printf statement at line 2296 should be deleted.

Please sign in to comment.