From: Mark Dickinson Date: Mon, 21 Jul 2008 22:49:36 +0000 (+0000) Subject: Issue #3369: fix memory leak in floatobject.c. Thanks Kristján Jónsson X-Git-Tag: v3.0b3~249 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=943f33912c243b0769023082691475012428da5a;p=python Issue #3369: fix memory leak in floatobject.c. Thanks Kristján Jónsson for the report and fix. --- diff --git a/Objects/floatobject.c b/Objects/floatobject.c index daf7ee807e..efad21250c 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -223,13 +223,19 @@ PyFloat_FromString(PyObject *v) p++; } if (PyOS_strnicmp(p, "inf", 4) == 0) { + if (s_buffer != NULL) + PyMem_FREE(s_buffer); Py_RETURN_INF(sign); } if (PyOS_strnicmp(p, "infinity", 9) == 0) { + if (s_buffer != NULL) + PyMem_FREE(s_buffer); Py_RETURN_INF(sign); } #ifdef Py_NAN if(PyOS_strnicmp(p, "nan", 4) == 0) { + if (s_buffer != NULL) + PyMem_FREE(s_buffer); Py_RETURN_NAN; } #endif