!128 Fix memory leaks for xmlACatalogAdd

From: @fly_fzc 
Reviewed-by: @licihua 
Signed-off-by: @licihua
This commit is contained in:
openeuler-ci-bot 2022-06-16 13:30:34 +00:00 committed by Gitee
commit 0a2541287b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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 Summary: Library providing XML and HTML support
Name: libxml2 Name: libxml2
Version: 2.9.12 Version: 2.9.12
Release: 6 Release: 7
License: MIT License: MIT
Group: Development/Libraries Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz 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 Patch9: Fix-buffering-in-xmlOutputBufferWrite.patch
Patch10:backport-CVE-2022-23308-Use-after-free-of-ID-and-IDREF-attrib.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 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 BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: python3-devel BuildRequires: python3-devel
@ -178,6 +179,12 @@ rm -fr %{buildroot}
%changelog %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 * Mon May 09 2022 fuanan <fuanan3@h-partners.com> - 2.9.12-6
- Type:CVE - Type:CVE
- ID:CVE-2022-29824 - ID:CVE-2022-29824