From 32660483368f2a29e42342d6218afb7544348776 Mon Sep 17 00:00:00 2001 From: dcommander Date: Thu, 21 Aug 2014 22:15:19 +0000 Subject: Subtle point, but dest->outbuffer is a pointer to the address of the JPEG buffer, which is stored in the calling program. Thus, *(dest->outbuffer) will always equal *outbuffer. We need to compare *outbuffer with dest->buffer instead to determine if the pointer is being reused. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1369 632fc199-4ca6-4c93-a231-07263d6284db --- jdatadst-tj.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jdatadst-tj.c b/jdatadst-tj.c index 8289d3a..a0e0f2e 100644 --- a/jdatadst-tj.c +++ b/jdatadst-tj.c @@ -165,15 +165,14 @@ jpeg_mem_dest_tj (j_compress_ptr cinfo, sizeof(my_mem_destination_mgr)); dest = (my_mem_dest_ptr) cinfo->dest; dest->newbuffer = NULL; - dest->outbuffer = NULL; + dest->buffer = NULL; } dest = (my_mem_dest_ptr) cinfo->dest; dest->pub.init_destination = init_mem_destination; dest->pub.empty_output_buffer = empty_mem_output_buffer; dest->pub.term_destination = term_mem_destination; - if (dest->outbuffer && *(dest->outbuffer) == *outbuffer && - *outbuffer != NULL && alloc) + if (dest->buffer == *outbuffer && *outbuffer != NULL && alloc) { reused = TRUE; dest->outbuffer = outbuffer; dest->outsize = outsize; -- cgit v1.2.3