Skip to content
This repository was archived by the owner on Dec 1, 2017. It is now read-only.

Commit 6a984bf

Browse files
author
erouault
committed
* libtiff/tif_predic.c: fix memory leaks in error code paths added in
previous commit (fix for MSVR 35105)
1 parent 3ca657a commit 6a984bf

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Diff for: ChangeLog

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2016-11-04 Even Rouault <even.rouault at spatialys.com>
2+
3+
* libtiff/tif_predic.c: fix memory leaks in error code paths added in
4+
previous commit (fix for MSVR 35105)
5+
16
2016-10-31 Even Rouault <even.rouault at spatialys.com>
27

38
* libtiff/tif_predict.h, libtiff/tif_predict.c:

Diff for: libtiff/tif_predict.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
409409
tmsize_t wc = cc / bps;
410410
tmsize_t count = cc;
411411
uint8 *cp = (uint8 *) cp0;
412-
uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
412+
uint8 *tmp;
413413

414414
if(cc%(bps*stride)!=0)
415415
{
@@ -418,6 +418,7 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
418418
return 0;
419419
}
420420

421+
tmp = (uint8 *)_TIFFmalloc(cc);
421422
if (!tmp)
422423
return 0;
423424

@@ -640,14 +641,16 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
640641
tmsize_t wc = cc / bps;
641642
tmsize_t count;
642643
uint8 *cp = (uint8 *) cp0;
643-
uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
644+
uint8 *tmp;
644645

645646
if((cc%(bps*stride))!=0)
646647
{
647648
TIFFErrorExt(tif->tif_clientdata, "fpDiff",
648649
"%s", "(cc%(bps*stride))!=0");
649650
return 0;
650651
}
652+
653+
tmp = (uint8 *)_TIFFmalloc(cc);
651654
if (!tmp)
652655
return 0;
653656

@@ -722,6 +725,7 @@ PredictorEncodeTile(TIFF* tif, uint8* bp0, tmsize_t cc0, uint16 s)
722725
{
723726
TIFFErrorExt(tif->tif_clientdata, "PredictorEncodeTile",
724727
"%s", "(cc0%rowsize)!=0");
728+
_TIFFfree( working_copy );
725729
return 0;
726730
}
727731
while (cc > 0) {

0 commit comments

Comments
 (0)