mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix leak found by Eric Huss.
This commit is contained in:
parent
22021579a9
commit
d56cbe57b8
1 changed files with 6 additions and 1 deletions
|
@ -3954,7 +3954,12 @@ add_tp_new_wrapper(PyTypeObject *type)
|
||||||
func = PyCFunction_New(tp_new_methoddef, (PyObject *)type);
|
func = PyCFunction_New(tp_new_methoddef, (PyObject *)type);
|
||||||
if (func == NULL)
|
if (func == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
return PyDict_SetItemString(type->tp_dict, "__new__", func);
|
if(PyDict_SetItemString(type->tp_dict, "__new__", func)) {
|
||||||
|
Py_DECREF(func);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Py_DECREF(func);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Slot wrappers that call the corresponding __foo__ slot. See comments
|
/* Slot wrappers that call the corresponding __foo__ slot. See comments
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue