Fix memory leaks for xmlACatalogAdd

This commit is contained in:
fuanan 2022-06-16 19:34:32 +08:00
parent 93104d315f
commit 136ca1dd79
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 9736e895d02e889b25c7e8a73afe3f7bf61dca27 Mon Sep 17 00:00:00 2001
From: xiezhipeng <xiezhipeng1@huawei.com>
Date: Thu, 16 Jun 2022 19:13:10 +0800
Subject: [PATCH] Fix memory leaks for xmlACatalogAdd
---
xmlcatalog.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 3f0e1b9..6fdbff9 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -527,6 +527,11 @@ int main(int argc, char **argv) {
xmlACatalogDump(catal, stdout);
}
i += 2;
+ /* Check for memory leaks */
+ if (catal != NULL)
+ xmlFreeCatalog(catal);
+ if (super != NULL)
+ xmlFreeCatalog(super);
} else {
if ((!strcmp(argv[i], "-add")) ||
(!strcmp(argv[i], "--add"))) {
--
1.8.3.1

View File

@ -1,7 +1,7 @@
Summary: Library providing XML and HTML support
Name: libxml2
Version: 2.9.12
Release: 6
Release: 7
License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
@ -18,6 +18,7 @@ Patch8: Patch-to-forbid-epsilon-reduction-of-final-states.patch
Patch9: Fix-buffering-in-xmlOutputBufferWrite.patch
Patch10:backport-CVE-2022-23308-Use-after-free-of-ID-and-IDREF-attrib.patch
Patch11:backport-CVE-2022-29824-Fix-integer-overflows-in-xmlBuf-and-xmlBuffer.patch
Patch12:Fix-memory-leaks-for-xmlACatalogAdd.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: python3-devel
@ -178,6 +179,12 @@ rm -fr %{buildroot}
%changelog
* Thu Jun 16 2022 fuanan <fuanan3@h-partners.com> - 2.9.12-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix memory leaks for xmlACatalogAdd
* Mon May 09 2022 fuanan <fuanan3@h-partners.com> - 2.9.12-6
- Type:CVE
- ID:CVE-2022-29824