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