diff options
Diffstat (limited to 'Modules/_lsprof.c')
-rw-r--r-- | Modules/_lsprof.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 39cf6e1..5e53d83 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -390,14 +390,19 @@ profiler_callback(PyObject *self, PyFrameObject *frame, int what, { PyCodeObject *code = PyFrame_GetCode(frame); ptrace_enter_call(self, (void *)code, (PyObject *)code); + Py_DECREF(code); break; } /* the 'frame' of a called function is about to finish (either normally or with an exception) */ case PyTrace_RETURN: - ptrace_leave_call(self, (void *)PyFrame_GetCode(frame)); + { + PyCodeObject *code = PyFrame_GetCode(frame); + ptrace_leave_call(self, (void *)code); + Py_DECREF(code); break; + } /* case PyTrace_EXCEPTION: If the exception results in the function exiting, a |