• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 9736e895d02e889b25c7e8a73afe3f7bf61dca27 Mon Sep 17 00:00:00 2001
2From: xiezhipeng <xiezhipeng1@huawei.com>
3Date: Thu, 16 Jun 2022 19:13:10 +0800
4Subject: [PATCH] Fix memory leaks for xmlACatalogAdd
5
6---
7 xmlcatalog.c | 5 +++++
8 1 file changed, 5 insertions(+)
9
10diff --git a/xmlcatalog.c b/xmlcatalog.c
11index 3f0e1b9..6fdbff9 100644
12--- a/xmlcatalog.c
13+++ b/xmlcatalog.c
14@@ -527,6 +527,11 @@ int main(int argc, char **argv) {
15 		    xmlACatalogDump(catal, stdout);
16 		}
17 		i += 2;
18+		/* Check for memory leaks */
19+		if (catal != NULL)
20+		    xmlFreeCatalog(catal);
21+		if (super != NULL)
22+		    xmlFreeCatalog(super);
23 	    } else {
24 		if ((!strcmp(argv[i], "-add")) ||
25 		    (!strcmp(argv[i], "--add"))) {
26--
271.8.3.1
28
29