diff options
author | Kristjan Valur Jonsson <sweskman@gmail.com> | 2012-05-31 09:37:31 (GMT) |
---|---|---|
committer | Kristjan Valur Jonsson <sweskman@gmail.com> | 2012-05-31 09:37:31 (GMT) |
commit | 85634d7a2e4b864c4ca3baa591e9479ffd5a2540 (patch) | |
tree | fda37abce087013b6b52f85a19a4ff33c1b13dce /Objects/frameobject.c | |
parent | 56517e5cb91c896024934a520d365d6e275eb1ad (diff) | |
download | cpython-85634d7a2e4b864c4ca3baa591e9479ffd5a2540.zip cpython-85634d7a2e4b864c4ca3baa591e9479ffd5a2540.tar.gz cpython-85634d7a2e4b864c4ca3baa591e9479ffd5a2540.tar.bz2 |
Issue #14909: A number of places were using PyMem_Realloc() apis and
PyObject_GC_Resize() with incorrect error handling. In case of errors,
the original object would be leaked. This checkin fixes those cases.
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r-- | Objects/frameobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 6208556..929385f 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -663,11 +663,13 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, f = free_list; free_list = free_list->f_back; if (Py_SIZE(f) < extras) { - f = PyObject_GC_Resize(PyFrameObject, f, extras); - if (f == NULL) { + PyFrameObject *new_f = PyObject_GC_Resize(PyFrameObject, f, extras); + if (new_f == NULL) { + PyObject_GC_Del(f); Py_DECREF(builtins); return NULL; } + f = new_f; } _Py_NewReference((PyObject *)f); } |