]> 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 15:00:30 +0000 (17:00 +0200)
committerChristian Heimes <christian@cheimes.de>
Mon, 10 Sep 2012 15:00:30 +0000 (17:00 +0200)
1  2 
Objects/typeobject.c

index f51700e034de8223fadf29422867c633e4097892,0fc0ad38e82a06f5455cc2e1f99698f7143054f9..88cca93dd108e2e87263946e386cc1e040825498
@@@ -3129,9 -2924,11 +3129,11 @@@ object_repr(PyObject *self
          Py_DECREF(mod);
          mod = NULL;
      }
 -    name = type_name(type, NULL);
 +    name = type_qualname(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