diff --git a/backport-subject-py-Fix-memory-leak.patch b/backport-subject-py-Fix-memory-leak.patch new file mode 100644 index 0000000000000000000000000000000000000000..d85da8dd88f9633abe8b45d2f409f695ae528f5b --- /dev/null +++ b/backport-subject-py-Fix-memory-leak.patch @@ -0,0 +1,29 @@ +From fd284bda6f7430b2e939f95c6836c972e22a2eb4 Mon Sep 17 00:00:00 2001 +From: Marek Blaha +Date: Tue, 26 Mar 2024 14:09:47 +0100 +Subject: [PATCH 293/300] subject-py: Fix memory leak + +Posible memory leak was detected in get_best_solution() method. +--- + python/hawkey/subject-py.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/python/hawkey/subject-py.cpp b/python/hawkey/subject-py.cpp +index a88d572a..3e1919e7 100644 +--- a/python/hawkey/subject-py.cpp ++++ b/python/hawkey/subject-py.cpp +@@ -361,8 +361,10 @@ get_best_solution(_SubjectObject *self, PyObject *args, PyObject *kwds) + HyNevra nevra{nullptr}; + + UniquePtrPyObject q(get_solution(self, args, kwds, &nevra)); +- if (!q) ++ if (!q) { ++ delete nevra; + return NULL; ++ } + PyObject *ret_dict = PyDict_New(); + PyDict_SetItem(ret_dict, PyString_FromString("query"), q.get()); + if (nevra) { +-- +2.33.0 + diff --git a/libdnf.spec b/libdnf.spec index c4a4684c71c9c1fb6e5cadb3128fe0b94eda4679..4d12edf18cd311f3fdd06ed76775af0d0732f8ac 100644 --- a/libdnf.spec +++ b/libdnf.spec @@ -18,7 +18,7 @@ Name: libdnf Version: 0.70.2 -Release: 2 +Release: 3 Summary: Library providing simplified C and Python API to libsolv License: LGPL-2.1-or-later URL: https://github.com/rpm-software-management/libdnf @@ -48,6 +48,7 @@ Patch6002: backport-python-bindings-Load-all-modules-with-RTLD_G Patch6003: backport-Avoid-reinstalling-installonly-packages-marked-for-ERASE.patch Patch6004: backport-dnf-repo-do-not-download-repository-if-our-local-cache-is-up-to-date.patch Patch6005: backport-dnf-repo-Fix-utimes-error-messages.patch +Patch6006: backport-subject-py-Fix-memory-leak.patch %description A Library providing simplified C and Python API to libsolv. @@ -127,6 +128,12 @@ popd %{python3_sitearch}/hawkey/ %changelog +* Thu May 16 2024 xiaozai - 0.70.2-3 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC: Fix memory leak detected in get_best_solution() method + * Tue Jan 02 2024 chenhaixing - 0.70.2-2 - Type:bugfix - CVE:NA