From de66ecc75fc06abbee21100e760cc7a5542c0308 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 16 Aug 2011 22:26:48 -0500 Subject: [PATCH] fix possible refleaks --- Objects/typeobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 3864b48b4bb..7c98cfdf37e 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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++; }