diff options
author | Even Rouault <even.rouault@spatialys.com> | 2016-11-04 09:19:13 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2016-11-04 09:19:13 +0000 |
commit | 3f5f68e91b2bd3f8788d22ed90cd3f6763554fd9 (patch) | |
tree | da282916c6f9b8ea112c61996bee012d6fcc362b /libtiff/tif_predict.c | |
parent | a41c294c3fa70d750aeb124947cd551b64f68b9c (diff) | |
download | libtiff-git-3f5f68e91b2bd3f8788d22ed90cd3f6763554fd9.tar.gz |
* libtiff/tif_predic.c: fix memory leaks in error code paths added in
previous commit (fix for MSVR 35105)
Diffstat (limited to 'libtiff/tif_predict.c')
-rw-r--r-- | libtiff/tif_predict.c | 10 |
1 files changed, 7 insertions, 3 deletions
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) { |