Skip to content
Snippets Groups Projects
Commit 42f09807 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez
Browse files

moved derefs to be called as soon as var is no longer needed

parent 4ed56859
Branches
No related tags found
No related merge requests found
......@@ -340,6 +340,9 @@ namespace ale {
// Call the function with the arguments.
PyObject* pResult = PyObject_CallObject(pFunc, pArgs);
Py_DECREF(pArgs);
Py_DECREF(pFunc);
Py_DECREF(pString);
if(!pResult) {
throw invalid_argument(getPyTraceback());
}
......@@ -355,13 +358,8 @@ namespace ale {
char *temp_str = PyBytes_AS_STRING(temp_bytes); // Borrowed pointer
cResult = temp_str; // copy into std::string
Py_DECREF(temp_str);
Py_DECREF(pResultStr);
Py_DECREF(temp_bytes);
Py_DECREF(pArgs);
Py_DECREF(pModule);
Py_DECREF(pString);
return cResult;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment