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+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1369 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2014-08-21 22:15:19 +00:00
parent 334b1963f7
commit ae9446b98f

View File

@@ -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;