From 26a07b5198e47d7874eef14e15dee2cc0e644cb9 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 14 Aug 2006 20:25:39 +0000 Subject: [PATCH] Fix refleak introduced in rev. 51248. --- Objects/stringobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 2189a8209f6..f3ef4b8645b 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -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) {