File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2867,7 +2867,11 @@ static void timer_callback(CFRunLoopTimerRef timer, void* info)
28672867 PyObject* method = info;
28682868 PyGILState_STATE gstate = PyGILState_Ensure ();
28692869 PyObject* result = PyObject_CallFunction (method, NULL );
2870- if (result==NULL ) PyErr_Print ();
2870+ if (result) {
2871+ Py_DECREF (result);
2872+ } else {
2873+ PyErr_Print ();
2874+ }
28712875 PyGILState_Release (gstate);
28722876}
28732877
@@ -2923,6 +2927,7 @@ static void context_cleanup(const void* info)
29232927 PyErr_SetString (PyExc_ValueError, " Cannot interpret _single attribute as True of False" );
29242928 return NULL ;
29252929 }
2930+ Py_DECREF (attribute);
29262931 attribute = PyObject_GetAttrString ((PyObject*)self, " _on_timer" );
29272932 if (attribute==NULL )
29282933 {
@@ -2942,10 +2947,10 @@ static void context_cleanup(const void* info)
29422947 timer_callback,
29432948 &context);
29442949 if (!timer) {
2950+ Py_DECREF (attribute);
29452951 PyErr_SetString (PyExc_RuntimeError, " Failed to create timer" );
29462952 return NULL ;
29472953 }
2948- Py_INCREF (attribute);
29492954 if (self->timer ) {
29502955 CFRunLoopTimerInvalidate (self->timer );
29512956 CFRelease (self->timer );
You can’t perform that action at this time.
0 commit comments