From 73c93fbe3f5f843a20bac2b46a33964ba19c612a Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Thu, 22 Jan 2026 02:39:10 +0100 Subject: [PATCH] Fix a memory leak Related: RHEL-120801 --- fix-memory-leak.patch | 23 +++++++++++++++++++++++ python3.14-lxml.spec | 4 ++++ 2 files changed, 27 insertions(+) create mode 100644 fix-memory-leak.patch diff --git a/fix-memory-leak.patch b/fix-memory-leak.patch new file mode 100644 index 0000000..8deedd3 --- /dev/null +++ b/fix-memory-leak.patch @@ -0,0 +1,23 @@ +From b9de95a1caf39c5eee35c984fd0b51ddd1b0d40e Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Sat, 17 Jan 2026 07:21:23 +0100 +Subject: [PATCH] Add missing "noexcept" to fix a memory leak. + +Fixes https://bugs.launchpad.net/lxml/+bug/2138421 +--- + src/lxml/etree.pyx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/lxml/etree.pyx b/src/lxml/etree.pyx +index 2ed3d1e15..3e7dca047 100644 +--- a/src/lxml/etree.pyx ++++ b/src/lxml/etree.pyx +@@ -668,7 +668,7 @@ cdef class DocInfo: + return root_name + + @cython.final +- cdef tree.xmlDtd* _get_c_dtd(self): ++ cdef tree.xmlDtd* _get_c_dtd(self) noexcept: + """"Return the DTD. Create it if it does not yet exist.""" + cdef xmlDoc* c_doc = self._doc._c_doc + cdef xmlNode* c_root_node diff --git a/python3.14-lxml.spec b/python3.14-lxml.spec index e81ffed..dd4ab1f 100644 --- a/python3.14-lxml.spec +++ b/python3.14-lxml.spec @@ -18,6 +18,10 @@ URL: https://github.com/lxml/lxml Source0: lxml-%{version}-no-isoschematron-rng.tar.gz Source1: get-lxml-source.sh +# Fix a memory leak +# Resolved upstream: https://github.com/lxml/lxml/commit/459d51e316c319c8f49b3b7d08fb80cbc8585f49 +Patch0: fix-memory-leak.patch + BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel