]> granicus.if.org Git - python/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 e34b10ce40a0aacc7237e9730e410511f34686fb..0fc0ad38e82a06f5455cc2e1f99698f7143054f9 100644 (file)
@@ -2925,8 +2925,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 && PyUnicode_CompareWithASCIIString(mod, "builtins"))
         rtn = PyUnicode_FromFormat("<%U.%U object at %p>", mod, name, self);
     else