summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2016-11-04 09:19:13 +0000
committerEven Rouault <even.rouault@spatialys.com>2016-11-04 09:19:13 +0000
commit3f5f68e91b2bd3f8788d22ed90cd3f6763554fd9 (patch)
treeda282916c6f9b8ea112c61996bee012d6fcc362b
parenta41c294c3fa70d750aeb124947cd551b64f68b9c (diff)
downloadlibtiff-git-3f5f68e91b2bd3f8788d22ed90cd3f6763554fd9.tar.gz
* libtiff/tif_predic.c: fix memory leaks in error code paths added in
previous commit (fix for MSVR 35105)
-rw-r--r--ChangeLog5
-rw-r--r--libtiff/tif_predict.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0379c3b7..48fb75d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-04 Even Rouault <even.rouault at spatialys.com>
+
+ * libtiff/tif_predic.c: fix memory leaks in error code paths added in
+ previous commit (fix for MSVR 35105)
+
2016-10-31 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_predict.h, libtiff/tif_predict.c:
diff --git a/libtiff/tif_predict.c b/libtiff/tif_predict.c
index 1e16854d..0b185d2e 100644
--- a/libtiff/tif_predict.c
+++ b/libtiff/tif_predict.c
@@ -1,4 +1,4 @@
-/* $Id: tif_predict.c,v 1.39 2016-10-31 17:24:26 erouault Exp $ */
+/* $Id: tif_predict.c,v 1.40 2016-11-04 09:19:13 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -409,7 +409,7 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
tmsize_t wc = cc / bps;
tmsize_t count = cc;
uint8 *cp = (uint8 *) cp0;
- uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
+ uint8 *tmp;
if(cc%(bps*stride)!=0)
{
@@ -418,6 +418,7 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
return 0;
}
+ tmp = (uint8 *)_TIFFmalloc(cc);
if (!tmp)
return 0;
@@ -640,7 +641,7 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
tmsize_t wc = cc / bps;
tmsize_t count;
uint8 *cp = (uint8 *) cp0;
- uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
+ uint8 *tmp;
if((cc%(bps*stride))!=0)
{
@@ -648,6 +649,8 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
"%s", "(cc%(bps*stride))!=0");
return 0;
}
+
+ tmp = (uint8 *)_TIFFmalloc(cc);
if (!tmp)
return 0;
@@ -722,6 +725,7 @@ PredictorEncodeTile(TIFF* tif, uint8* bp0, tmsize_t cc0, uint16 s)
{
TIFFErrorExt(tif->tif_clientdata, "PredictorEncodeTile",
"%s", "(cc0%rowsize)!=0");
+ _TIFFfree( working_copy );
return 0;
}
while (cc > 0) {