Fix refleak introduced in rev. 51248.

This commit is contained in:
Georg Brandl 2006-08-14 20:25:39 +00:00
parent 1ce433e937
commit 26a07b5198
1 changed files with 3 additions and 1 deletions

View File

@ -4226,8 +4226,10 @@ _PyString_FormatLong(PyObject *val, int flags, int prec, int type,
return NULL;
buf = PyString_AsString(result);
if (!buf)
if (!buf) {
Py_DECREF(result);
return NULL;
}
/* To modify the string in-place, there can only be one reference. */
if (result->ob_refcnt != 1) {