diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2008-07-21 22:49:36 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2008-07-21 22:49:36 (GMT) |
commit | 943f33912c243b0769023082691475012428da5a (patch) | |
tree | 97fdc645433f98e79f18563964f35d4a39cf9f7a /Objects/floatobject.c | |
parent | a05ada3128f5cbe00ef5c51e6317cc984b102c40 (diff) | |
download | cpython-943f33912c243b0769023082691475012428da5a.zip cpython-943f33912c243b0769023082691475012428da5a.tar.gz cpython-943f33912c243b0769023082691475012428da5a.tar.bz2 |
Issue #3369: fix memory leak in floatobject.c. Thanks Kristján Jónsson
for the report and fix.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index daf7ee8..efad212 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 |