File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -2867,7 +2867,11 @@ static void timer_callback(CFRunLoopTimerRef timer, void* info)
2867
2867
PyObject* method = info;
2868
2868
PyGILState_STATE gstate = PyGILState_Ensure ();
2869
2869
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
+ }
2871
2875
PyGILState_Release (gstate);
2872
2876
}
2873
2877
@@ -2923,6 +2927,7 @@ static void context_cleanup(const void* info)
2923
2927
PyErr_SetString (PyExc_ValueError, " Cannot interpret _single attribute as True of False" );
2924
2928
return NULL ;
2925
2929
}
2930
+ Py_DECREF (attribute);
2926
2931
attribute = PyObject_GetAttrString ((PyObject*)self, " _on_timer" );
2927
2932
if (attribute==NULL )
2928
2933
{
@@ -2942,10 +2947,10 @@ static void context_cleanup(const void* info)
2942
2947
timer_callback,
2943
2948
&context);
2944
2949
if (!timer) {
2950
+ Py_DECREF (attribute);
2945
2951
PyErr_SetString (PyExc_RuntimeError, " Failed to create timer" );
2946
2952
return NULL ;
2947
2953
}
2948
- Py_INCREF (attribute);
2949
2954
if (self->timer ) {
2950
2955
CFRunLoopTimerInvalidate (self->timer );
2951
2956
CFRelease (self->timer );
You can’t perform that action at this time.
0 commit comments