]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fixed memory leak in error branch of object_repr which may leak a reference to mod...
authorChristian Heimes <christian@cheimes.de>
Mon, 10 Sep 2012 14:57:36 +0000 (16:57 +0200)
committerChristian Heimes <christian@cheimes.de>
Mon, 10 Sep 2012 14:57:36 +0000 (16:57 +0200)
Objects/typeobject.c

index e527eed792450f0c89ec07f5895555bf16273341..339e69ec4b971ed656d9094e68d9d58639b2994a 100644 (file)
@@ -2984,8 +2984,10 @@ object_repr(PyObject *self)
         mod = NULL;
     }
     name = type_name(type, NULL);
-    if (name == NULL)
+    if (name == NULL) {
+        Py_XDECREF(mod);
         return NULL;
+    }
     if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__"))
         rtn = PyString_FromFormat("<%s.%s object at %p>",
                                   PyString_AS_STRING(mod),