From: Brett Cannon <bcannon@gmail.com>
Date: Thu, 2 Mar 2006 04:31:55 +0000 (+0000)
Subject: Add a missing Py_DECREF to BaseException__unicode__ .
X-Git-Tag: v2.5a0~405
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46872b16135c8c9c9139687ca23df4545c1b79f2;p=python

Add a missing Py_DECREF to BaseException__unicode__ .
---

diff --git a/Python/exceptions.c b/Python/exceptions.c
index c8c7b69d83..560aeb86e0 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -285,16 +285,22 @@ BaseException__unicode__(PyObject *self, PyObject *args)
 	}
 	else if (args_len == 1) {
 		PyObject *temp = PySequence_GetItem(args, 0);
+		PyObject *unicode_obj;
+
 		if (!temp) {
 			Py_DECREF(args);
 			return NULL;
 		}
 		Py_DECREF(args);
-		return PyObject_Unicode(temp);
+		unicode_obj = PyObject_Unicode(temp);
+		Py_DECREF(temp);
+		return unicode_obj;
 	}
 	else {
+		PyObject *unicode_obj = PyObject_Unicode(args);
+
 		Py_DECREF(args);
-		return PyObject_Unicode(args);
+		return unicode_obj;
 	}
 }
 #endif /* Py_USING_UNICODE */