Fixed a problem when saving non-indexed images (reported by Trent Gamblin)

This commit is contained in:
David Capello 2007-12-09 01:52:58 +00:00
parent 9b755b2834
commit 1851db4ac7
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2007-12-08 David A. Capello <dacap@users.sourceforge.net>
* src/file/png_format.c (save_PNG): Fixed a problem when saving
non-indexed images (reported by Trent Gamblin).
2007-12-06 David A. Capello <dacap@users.sourceforge.net>
* src/widgets/editor/editor.c (editor_draw_sprite): Fixed to allow

View File

@ -488,8 +488,10 @@ static int save_PNG(Sprite *sprite)
libpng mallocs info_ptr->palette, libpng will free it). If you
allocated it with malloc() instead of png_malloc(), use free() instead
of png_free(). */
png_free(png_ptr, palette);
palette = NULL;
if (image->imgtype == IMAGE_INDEXED) {
png_free(png_ptr, palette);
palette = NULL;
}
/* clean up after the write, and free any memory allocated */
png_destroy_write_struct(&png_ptr, &info_ptr);