--- /dev/null
+Fix reference leaks in various unusual error scenarios.
}
if (PySys_Audit("cpython.run_interactivehook", "O", hook) < 0) {
+ Py_DECREF(hook);
goto error;
}
// Get the error message.
PyObject *args = PyException_GetArgs(exc);
if (args == NULL || args == Py_None || PyObject_Size(args) < 1) {
+ Py_XDECREF(args);
assert(!PyErr_Occurred());
return 0;
}
module_dict = get_mod_dict(modobj);
if (module_dict == NULL || !PyDict_CheckExact(module_dict)) {
+ Py_DECREF(lazy_submodules);
goto done;
}
"traceback",
"_print_exception_bltin");
if (print_exception_fn == NULL || !PyCallable_Check(print_exception_fn)) {
+ Py_XDECREF(print_exception_fn);
goto fallback;
}
PyObject *realVersion = _sys_getwindowsversion_from_kernel32();
if (!realVersion) {
if (!PyErr_ExceptionMatches(PyExc_WindowsError)) {
- return NULL;
+ goto error;
}
PyErr_Clear();