From: Georg Brandl Date: Mon, 26 Feb 2007 10:35:10 +0000 (+0000) Subject: Fix leak in the print function. X-Git-Tag: v3.0a1~1179 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=257d3d93caa1c5e8320ae1960e0d81e58a7b90c0;p=thirdparty%2FPython%2Fcpython.git Fix leak in the print function. --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index c71aed1dd7dc..78aeeb7937e1 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1392,12 +1392,14 @@ static PyObject * builtin_print(PyObject *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"sep", "end", "file", 0}; - PyObject *dummy_args = PyTuple_New(0); + static PyObject *dummy_args; PyObject *sep = NULL, *end = NULL, *file = NULL; int i, err; - if (dummy_args == NULL) - return NULL; + if (dummy_args == NULL) { + if (!(dummy_args = PyTuple_New(0))) + return NULL; + } if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print", kwlist, &sep, &end, &file)) return NULL;