summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2022-01-24 18:45:26 +0100
committerGitHub <noreply@github.com>2022-01-24 18:45:26 +0100
commit5f100ffa78b74da8020b71d1582a8979193c1359 (patch)
tree7e2a0a92d2a4b78df446d18c9c5c3bf1f85a9c91
parent178d26f50af21ec23d6e43814b9b602590b5865c (diff)
parent85a6f8fcdb2bc1530934f8cf684bdab86f1f2a1c (diff)
downloadlibexpat-git-5f100ffa78b74da8020b71d1582a8979193c1359.tar.gz
Merge pull request #545 from libexpat/issue-544-fix-xmlwf-memleak-on-file-opening-error
[>=2.3.0] xmlwf: Fix a memory leak on output file opening error (fixes #544)
-rw-r--r--expat/Changes6
-rw-r--r--expat/xmlwf/xmlwf.c4
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;