Commit 943f3391 authored by Mark Dickinson's avatar Mark Dickinson

Issue #3369: fix memory leak in floatobject.c. Thanks Kristján Jónsson

for the report and fix.
parent a05ada31
...@@ -223,13 +223,19 @@ PyFloat_FromString(PyObject *v) ...@@ -223,13 +223,19 @@ PyFloat_FromString(PyObject *v)
p++; p++;
} }
if (PyOS_strnicmp(p, "inf", 4) == 0) { if (PyOS_strnicmp(p, "inf", 4) == 0) {
if (s_buffer != NULL)
PyMem_FREE(s_buffer);
Py_RETURN_INF(sign); Py_RETURN_INF(sign);
} }
if (PyOS_strnicmp(p, "infinity", 9) == 0) { if (PyOS_strnicmp(p, "infinity", 9) == 0) {
if (s_buffer != NULL)
PyMem_FREE(s_buffer);
Py_RETURN_INF(sign); Py_RETURN_INF(sign);
} }
#ifdef Py_NAN #ifdef Py_NAN
if(PyOS_strnicmp(p, "nan", 4) == 0) { if(PyOS_strnicmp(p, "nan", 4) == 0) {
if (s_buffer != NULL)
PyMem_FREE(s_buffer);
Py_RETURN_NAN; Py_RETURN_NAN;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment