mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #3369: fix memory leak in floatobject.c. Thanks Kristján Jónsson
for the report and fix.
This commit is contained in:
parent
a05ada3128
commit
943f33912c
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue