Fix memory leak when running tjunittest -yuv
Closes #61
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 101a066..90e67f3 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -19,6 +19,9 @@
long, so this version of libjpeg-turbo activates the accelerated Huffman
decoder only if there are > 512 bytes of data in the input buffer.
+[3] Fixed a memory leak in tjunittest encountered when running the program
+with the -yuv option.
+
1.4.2
=====
diff --git a/tjunittest.c b/tjunittest.c
index 0c81cbe..6a4022f 100644
--- a/tjunittest.c
+++ b/tjunittest.c
@@ -638,7 +638,7 @@
&dstSize, subsamp, 100, alloc? 0:TJFLAG_NOREALLOC));
}
free(srcBuf); srcBuf=NULL;
- if(!alloc)
+ if(!alloc || doyuv)
{
tjFree(dstBuf); dstBuf=NULL;
}
@@ -670,7 +670,7 @@
&dstSize, subsamp, 100, alloc? 0:TJFLAG_NOREALLOC));
}
free(srcBuf); srcBuf=NULL;
- if(!alloc)
+ if(!alloc || doyuv)
{
tjFree(dstBuf); dstBuf=NULL;
}