From 2eda8212e4b01c9b4d343dd0eaa579f0bba036e7 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 23 Mar 2012 19:32:38 +0000 Subject: [PATCH] Ensure that tjDecompress2() exits cleanly if setDecompDefaults() fails git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.2.x@821 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/turbojpeg.c b/turbojpeg.c index 2d5959a..37ad5a3 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2011 D. R. Commander. All Rights Reserved. + * Copyright (C)2009-2012 D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -756,7 +756,10 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf, jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize); jpeg_read_header(dinfo, TRUE); - if(setDecompDefaults(dinfo, pixelFormat)==-1) return -1; + if(setDecompDefaults(dinfo, pixelFormat)==-1) + { + retval=-1; goto bailout; + } if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE; -- 2.40.0