Skip to content

Commit

Permalink
subject-py: Fix memory leak
Browse files Browse the repository at this point in the history
Upstream commit: fd284bd

Posible memory leak was detected in get_best_solution() method.

Resolves: https://issues.redhat.com/browse/RHEL-26226
  • Loading branch information
m-blaha authored and ppisar committed Apr 18, 2024
1 parent 3c5641a commit fc3dfec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/hawkey/subject-py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fc3dfec

Please sign in to comment.