Skip to content

Commit

Permalink
Fix memory leak with PyDict_Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
MinyazevR authored and usiems committed Aug 30, 2024
1 parent 9d56817 commit c9d281f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/PythonQtInstanceWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,9 @@ static PyObject *PythonQtInstanceWrapper_getattro(PyObject *obj,PyObject *name)
}

if (qstrcmp(attributeName, "__dict__")==0) {
PyObject* dict = PyBaseObject_Type.tp_getattro(obj, name);
dict = PyDict_Copy(dict);
PyObject* objectDict = PyBaseObject_Type.tp_getattro(obj, name);
PyObject* dict = PyDict_Copy(objectDict);
Py_DECREF(objectDict);

if (wrapper->_obj) {
// we need to replace the properties with their real values...
Expand Down

0 comments on commit c9d281f

Please sign in to comment.