Commit 1059dc70 authored by Barry Warsaw's avatar Barry Warsaw

Exception__str__(): In case 1, be sure to decref the tmp local

variable.  This crushes another memory leak.  Slight rewrite
included.
parent da7c67c0
......@@ -231,7 +231,6 @@ static PyObject*
Exception__str__(PyObject* self, PyObject* args)
{
PyObject* out;
PyObject* tmp;
if (!PyArg_ParseTuple(args, "O", &self))
return NULL;
......@@ -245,11 +244,16 @@ Exception__str__(PyObject* self, PyObject* args)
out = PyString_FromString("");
break;
case 1:
if (!(tmp = PySequence_GetItem(args, 0)))
out = NULL;
else
{
PyObject* tmp = PySequence_GetItem(args, 0);
if (tmp) {
out = PyObject_Str(tmp);
Py_DECREF(tmp);
}
else
out = NULL;
break;
}
default:
out = PyObject_Str(args);
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment