]> granicus.if.org Git - python/commitdiff
fix possible refleaks
authorBenjamin Peterson <benjamin@python.org>
Wed, 17 Aug 2011 03:26:48 +0000 (22:26 -0500)
committerBenjamin Peterson <benjamin@python.org>
Wed, 17 Aug 2011 03:26:48 +0000 (22:26 -0500)
Objects/typeobject.c

index 3864b48b4bba6c36a20010a1e277b30ed80dec3b..7c98cfdf37ea495f34c1b8515845d45eaf2a74f0 100644 (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++;
         }