From: Barry Warsaw Date: Thu, 28 Jan 1999 04:21:35 +0000 (+0000) Subject: builtin_map(): Nailed memory leak. PyList_Append() borrows a X-Git-Tag: v1.5.2b2~248 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2133287c3ed12557cb1dde84ffe928e1f04eeda9;p=python builtin_map(): Nailed memory leak. PyList_Append() borrows a reference, so you have to DECREF the appended value. This was a fun one! --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index df6b98b42c..1929ae92ba 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -903,6 +903,7 @@ builtin_map(self, args) if (i >= len) { if (PyList_Append(result, value) < 0) goto Fail_1; + Py_DECREF(value); } else { if (PyList_SetItem(result, i, value) < 0)