]> granicus.if.org Git - python/commitdiff
Fix refleak introduced in rev. 51248.
authorGeorg Brandl <georg@python.org>
Mon, 14 Aug 2006 20:25:39 +0000 (20:25 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 14 Aug 2006 20:25:39 +0000 (20:25 +0000)
Objects/stringobject.c

index 2189a8209f60de73441e4fe7d4ecd6d1fadf2ca7..f3ef4b8645bda824489d9e604db916577642f79a 100644 (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) {