!133 Fix memory leaks in xmlACatalogAdd when xmlHashAddEntry failed

From: @fly_fzc 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2022-06-24 07:22:51 +00:00 committed by Gitee
commit 24a5ba8e03
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From 43555b3ff9c28a44aa27f447475b9f9cfccbe702 Mon Sep 17 00:00:00 2001
From: xiezhipeng <xiezhipeng1@huawei.com>
Date: Fri, 24 Jun 2022 09:39:54 +0800
Subject: [PATCH] fix memory leaks in xmlACatalogAdd
---
catalog.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/catalog.c b/catalog.c
index effbb2e..866e753 100644
--- a/catalog.c
+++ b/catalog.c
@@ -2981,6 +2981,8 @@ xmlACatalogAdd(xmlCatalogPtr catal, const xmlChar * type,
if (catal->sgml == NULL)
catal->sgml = xmlHashCreate(10);
res = xmlHashAddEntry(catal->sgml, orig, entry);
+ if (res)
+ xmlFreeCatalogEntry(entry, NULL);
}
}
return (res);
--
1.8.3.1

View File

@ -1,7 +1,7 @@
Summary: Library providing XML and HTML support
Name: libxml2
Version: 2.9.12
Release: 7
Release: 8
License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
@ -19,6 +19,7 @@ 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
Patch13:Fix-memory-leaks-in-xmlACatalogAdd-when-xmlHashAddEntry-failed.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: python3-devel
@ -179,6 +180,12 @@ rm -fr %{buildroot}
%changelog
* Fri Jun 24 2022 fuanan <fuanan3@h-partners.com> - 2.9.12-8
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix memory leaks in xmlACatalogAdd when xmlHashAddEntry failed
* Thu Jun 16 2022 fuanan <fuanan3@h-partners.com> - 2.9.12-7
- Type:bugfix
- ID:NA