From e42566816c5661f2f095683cd93937acb99c2fba Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 2 Mar 2016 10:55:37 -0800 Subject: [PATCH] GUAC-1389: PNG encoder should always release palette storage if an error occurs. --- src/libguac/encode-png.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libguac/encode-png.c b/src/libguac/encode-png.c index 516c1f6c..266749c8 100644 --- a/src/libguac/encode-png.c +++ b/src/libguac/encode-png.c @@ -318,6 +318,7 @@ int guac_png_write(guac_socket* socket, guac_stream* stream, png_info = png_create_info_struct(png); if (!png_info) { png_destroy_write_struct(&png, NULL); + guac_palette_free(palette); guac_error = GUAC_STATUS_INTERNAL_ERROR; guac_error_message = "libpng failed to create info structure"; return -1; @@ -326,6 +327,7 @@ int guac_png_write(guac_socket* socket, guac_stream* stream, /* Set error handler */ if (setjmp(png_jmpbuf(png))) { png_destroy_write_struct(&png, &png_info); + guac_palette_free(palette); guac_error = GUAC_STATUS_IO_ERROR; guac_error_message = "libpng output error"; return -1;