From 4e80eea60e439d6fb0a12bb803ca52061f29f7d6 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 10 Sep 2012 03:00:14 +0200 Subject: [PATCH] Fixed possible reference leak to mod when type_name() returns NULL --- Objects/typeobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 69cb02da09c..e527eed7924 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -686,8 +686,10 @@ type_repr(PyTypeObject *type) mod = NULL; } name = type_name(type, NULL); - if (name == NULL) + if (name == NULL) { + Py_XDECREF(mod); return NULL; + } if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) kind = "class";