diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-07-14 10:28:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-07-14 10:30:52 +0300 |
commit | f5e020a7a6ad6451fcaf075ae14f7014b8a4faea (patch) | |
tree | fabaa955b5da459f4a254f4b5d8c912e55f8e627 /source/gameengine/GameLogic/SCA_PythonController.cpp | |
parent | cca57bf04c9b84da742743343077db9b3f6f7025 (diff) |
PyAPI: fix memory leaks in dictionary assignment
Thanks to Kévin Dietrich for spotting driver leak,
checked other uses of PyDict_SetItem and found more.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PythonController.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PythonController.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 25936b34fde..fd2e723741c 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -163,7 +163,9 @@ void SCA_PythonController::SetNamespace(PyObject* pythondictionary) /* Without __file__ set the sys.argv[0] is used for the filename * which ends up with lines from the blender binary being printed in the console */ - PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_From_STR_String(m_scriptName)); + PyObject *value = PyUnicode_From_STR_String(m_scriptName); + PyDict_SetItemString(m_pythondictionary, "__file__", value); + Py_DECREF(value); } #endif |