]> granicus.if.org Git - libjpeg-turbo/commitdiff
Fix memory leak in new TurboJPEG auto-reallocation mode
authorDRC <dcommander@users.sourceforge.net>
Tue, 24 May 2011 15:15:15 +0000 (15:15 +0000)
committerDRC <dcommander@users.sourceforge.net>
Tue, 24 May 2011 15:15:15 +0000 (15:15 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@633 632fc199-4ca6-4c93-a231-07263d6284db

jdatadst-tj.c

index 3816f9567cdfefa56d70e460fb980066c4000985..cb674dca9f48d3f337d61f694355c2235f5f3b70 100644 (file)
@@ -160,6 +160,8 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo,
     cinfo->dest = (struct jpeg_destination_mgr *)
       (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
                                  SIZEOF(my_mem_destination_mgr));
+    dest = (my_mem_dest_ptr) cinfo->dest;
+    dest->newbuffer = NULL;
   }
 
   dest = (my_mem_dest_ptr) cinfo->dest;
@@ -168,7 +170,6 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo,
   dest->pub.term_destination = term_mem_destination;
   dest->outbuffer = outbuffer;
   dest->outsize = outsize;
-  dest->newbuffer = NULL;
   dest->alloc = alloc;
 
   if (*outbuffer == NULL || *outsize == 0) {