summaryrefslogtreecommitdiff
path: root/debian/patches/str4393-fix-memoryleak-in-rastertolabel.patch
blob: 5a090daa371b56dc08ddc1bf727b6c5159516c47 (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
32
33
34
35
36
37
38
Description: Make sure that all allocated buffers are freed regardless of driver
Author: Michael Sweet <msweet@apple.com>
Bug: https://www.cups.org/str.php?L4393
--- a/filter/rastertolabel.c
+++ b/filter/rastertolabel.c
@@ -639,13 +639,6 @@
 
         puts("^IDR:CUPS.GRF^FS");
 	puts("^XZ");
-
-       /*
-        * Free compression buffers...
-	*/
-
-	free(CompBuffer);
-	free(LastBuffer);
         break;
 
     case ZEBRA_CPCL :
@@ -714,6 +707,18 @@
   */
 
   free(Buffer);
+
+  if (CompBuffer)
+  {
+    free(CompBuffer);
+    CompBuffer = NULL;
+  }
+
+  if (LastBuffer)
+  {
+    free(LastBuffer);
+    LastBuffer = NULL;
+  }
 }