* libtiff/tif_pixarlog.c: fix memory leak in error code path of

PixarLogSetupDecode(). Patch by Nicolás Peña.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2665
This commit is contained in:
Even Rouault 2017-02-18 20:30:26 +00:00
parent 09a7433335
commit 19a159d7c4
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2017-02-18 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_pixarlog.c: fix memory leak in error code path of
PixarLogSetupDecode(). Patch by Nicolás Peña.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2665
2017-02-18 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_lzw.c: in LZWPostEncode(), increase, if necessary, the

View File

@ -1,4 +1,4 @@
/* $Id: tif_pixarlog.c,v 1.49 2016-12-02 23:05:51 erouault Exp $ */
/* $Id: tif_pixarlog.c,v 1.50 2017-02-18 20:30:26 erouault Exp $ */
/*
* Copyright (c) 1996-1997 Sam Leffler
@ -699,6 +699,9 @@ PixarLogSetupDecode(TIFF* tif)
if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
sp->user_datafmt = PixarLogGuessDataFmt(td);
if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
_TIFFfree(sp->tbuf);
sp->tbuf = NULL;
sp->tbuf_size = 0;
TIFFErrorExt(tif->tif_clientdata, module,
"PixarLog compression can't handle bits depth/data format combination (depth: %d)",
td->td_bitspersample);
@ -706,6 +709,9 @@ PixarLogSetupDecode(TIFF* tif)
}
if (inflateInit(&sp->stream) != Z_OK) {
_TIFFfree(sp->tbuf);
sp->tbuf = NULL;
sp->tbuf_size = 0;
TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg ? sp->stream.msg : "(null)");
return (0);
} else {