1 diff --git a/third_party/libtiff/tif_ojpeg.c b/third_party/libtiff/tif_ojpeg.c 2 index f69b00148..276d562df 100644 3 --- a/third_party/libtiff/tif_ojpeg.c 4 +++ b/third_party/libtiff/tif_ojpeg.c 5 @@ -1794,6 +1794,8 @@ OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif) 6 _TIFFfree(ob); 7 return(0); 8 } 9 + if (sp->qtable[m]!=0) 10 + _TIFFfree(sp->qtable[m]); 11 sp->qtable[m]=ob; 12 sp->sof_tq[m]=m; 13 } 14 @@ -1861,6 +1863,8 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif) 15 _TIFFfree(rb); 16 return(0); 17 } 18 + if (sp->dctable[m]!=0) 19 + _TIFFfree(sp->dctable[m]); 20 sp->dctable[m]=rb; 21 sp->sos_tda[m]=(m<<4); 22 } 23 @@ -1928,6 +1932,8 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif) 24 _TIFFfree(rb); 25 return(0); 26 } 27 + if (sp->actable[m]) 28 + _TIFFfree(sp->actable[m]); 29 sp->actable[m]=rb; 30 sp->sos_tda[m]=(sp->sos_tda[m]|m); 31 } 32