fix possible refleaks

This commit is contained in:
Benjamin Peterson 2011-08-16 22:26:48 -05:00
parent 4047d68a05
commit de66ecc75f
1 changed files with 3 additions and 1 deletions

View File

@ -2235,8 +2235,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
(add_weak && strcmp(s, "__weakref__") == 0))
continue;
tmp =_Py_Mangle(name, tmp);
if (!tmp)
if (!tmp) {
Py_DECREF(newslots);
goto bad_slots;
}
PyList_SET_ITEM(newslots, j, tmp);
j++;
}