Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.
Permalink
Browse files Browse the repository at this point in the history
* libtiff/tif_predic.c: fix memory leaks in error code paths added in
previous commit (fix for MSVR 35105)
  • Loading branch information
erouault committed Nov 4, 2016
1 parent 3ca657a commit 6a984bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions 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:
Expand Down
8 changes: 6 additions & 2 deletions libtiff/tif_predict.c
Expand Up @@ -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)
{
Expand All @@ -418,6 +418,7 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
return 0;
}

tmp = (uint8 *)_TIFFmalloc(cc);
if (!tmp)
return 0;

Expand Down Expand Up @@ -640,14 +641,16 @@ 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)
{
TIFFErrorExt(tif->tif_clientdata, "fpDiff",
"%s", "(cc%(bps*stride))!=0");
return 0;
}

tmp = (uint8 *)_TIFFmalloc(cc);
if (!tmp)
return 0;

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 6a984bf

Please sign in to comment.