Commit bdd3567c authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

_tkinter: Fix refleak in getint() (#2153)

PyNumber_Int() creates a new reference: need to decrement result
reference counter.
parent 15a6127e
...@@ -2131,8 +2131,12 @@ Tkapp_GetInt(PyObject *self, PyObject *args) ...@@ -2131,8 +2131,12 @@ Tkapp_GetInt(PyObject *self, PyObject *args)
result = fromWideIntObj(self, value); result = fromWideIntObj(self, value);
#endif #endif
Tcl_DecrRefCount(value); Tcl_DecrRefCount(value);
if (result != NULL) if (result != NULL) {
return PyNumber_Int(result); PyObject *resint = PyNumber_Int(result);
Py_DECREF(result);
return resint;
}
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment