1 diff --git a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c 2 index 29535d31e..80006d5b1 100644 3 --- a/third_party/libtiff/tif_pixarlog.c 4 +++ b/third_party/libtiff/tif_pixarlog.c 5 @@ -697,6 +697,9 @@ PixarLogSetupDecode(TIFF* tif) 6 if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) 7 sp->user_datafmt = PixarLogGuessDataFmt(td); 8 if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) { 9 + _TIFFfree(sp->tbuf); 10 + sp->tbuf = NULL; 11 + sp->tbuf_size = 0; 12 TIFFErrorExt(tif->tif_clientdata, module, 13 "PixarLog compression can't handle bits depth/data format combination (depth: %d)", 14 td->td_bitspersample); 15 @@ -704,6 +707,9 @@ PixarLogSetupDecode(TIFF* tif) 16 } 17 18 if (inflateInit(&sp->stream) != Z_OK) { 19 + _TIFFfree(sp->tbuf); 20 + sp->tbuf = NULL; 21 + sp->tbuf_size = 0; 22 TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg); 23 return (0); 24 } else { 25