1 diff --git a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c 2 index 80006d5b1..29535d31e 100644 3 --- a/third_party/libtiff/tif_pixarlog.c 4 +++ b/third_party/libtiff/tif_pixarlog.c 5 @@ -697,9 +697,6 @@ 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 @@ -707,9 +704,6 @@ 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 diff --git a/third_party/libtiff/tif_predict.c b/third_party/libtiff/tif_predict.c 26 index 1388dde59..8975672ae 100644 27 --- a/third_party/libtiff/tif_predict.c 28 +++ b/third_party/libtiff/tif_predict.c 29 @@ -109,7 +109,10 @@ PredictorSetupDecode(TIFF* tif) 30 TIFFDirectory* td = &tif->tif_dir; 31 32 if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif)) 33 + { 34 + (*tif->tif_cleanup)(tif); 35 return 0; 36 + } 37 38 if (sp->predictor == 2) { 39 switch (td->td_bitspersample) { 40