summaryrefslogtreecommitdiffstats
path: root/source/l/expat/5f100ffa78b74da8020b71d1582a8979193c1359.patch
blob: 59404f309a36adf72cfd83e24ae1d73d879e2c71 (plain) (blame)
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
39
40
41
42
43
44
45
From 85a6f8fcdb2bc1530934f8cf684bdab86f1f2a1c Mon Sep 17 00:00:00 2001
From: Sebastian Pipping <sebastian@pipping.org>
Date: Thu, 20 Jan 2022 04:41:47 +0100
Subject: [PATCH] xmlwf: Fix a memory leak on output file opening error

---
 expat/Changes       | 6 ++++++
 expat/xmlwf/xmlwf.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/expat/Changes b/expat/Changes
index 64d75d05..5ff5da5e 100644
--- a/expat/Changes
+++ b/expat/Changes
@@ -11,8 +11,14 @@ Release x.x.x xxx xxxxxxx xx xxxx
                     common and default).
                     Impact is denial of service or more.
 
+        Bug fixes:
+       #544 #545  xmlwf: Fix a memory leak on output file opening error
+
         Special thanks to:
+            hwt0415
             Samanta Navarro
+                 and
+            Clang LeakSan and the Clang team
 
 Release 2.4.3 Sun January 16 2022
         Security fixes:
diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c
index 29118bb6..b6f300b0 100644
--- a/expat/xmlwf/xmlwf.c
+++ b/expat/xmlwf/xmlwf.c
@@ -1175,9 +1175,9 @@ tmain(int argc, XML_Char **argv) {
       if (! userData.fp) {
         tperror(outName);
         exitCode = XMLWF_EXIT_OUTPUT_ERROR;
+        free(outName);
+        XML_ParserFree(parser);
         if (continueOnError) {
-          free(outName);
-          cleanupUserData(&userData);
           continue;
         } else {
           break;