Skip to content

Commit

Permalink
subject-py: Fix memory leak
Browse files Browse the repository at this point in the history
Posible memory leak was detected in get_best_solution() method.
  • Loading branch information
m-blaha authored and jan-kolarik committed Mar 27, 2024
1 parent f2399ac commit fd284bd
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 fd284bd

Please sign in to comment.