From f025663d4acb7e63db0e51c85726299c031258bc Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 28 Mar 2009 23:26:47 +0000 Subject: [PATCH] jpeg.c: fix a huge resource leak in the error codepath of the JPEG codec. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3414 92316355-f0b4-4df1-b90c-862c8a59935f --- pipi/codec/jpeg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pipi/codec/jpeg.c b/pipi/codec/jpeg.c index 4b08471..2c7e77a 100644 --- a/pipi/codec/jpeg.c +++ b/pipi/codec/jpeg.c @@ -68,13 +68,13 @@ pipi_image_t *pipi_load_jpeg(const char *name) unsigned int i, j, k = 0; FILE *fp; - if(setjmp(jerr.setjmp_buffer)) - return NULL; - fp = fopen(name, "rb"); if(!fp) return NULL; + if(setjmp(jerr.setjmp_buffer)) + goto end; + cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = error_msg; jerr.pub.emit_message = emit_msg;