Commit d56cbe57 authored by Raymond Hettinger's avatar Raymond Hettinger

Fix leak found by Eric Huss.

parent 22021579
......@@ -3954,7 +3954,12 @@ add_tp_new_wrapper(PyTypeObject *type)
func = PyCFunction_New(tp_new_methoddef, (PyObject *)type);
if (func == NULL)
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
......
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