diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-03-24 17:22:24 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-03-24 17:22:24 (GMT) |
commit | b39903b0a0f1660714939002170d26f020ffc85a (patch) | |
tree | 0d679ac8f251b2e3bc4b912920147e1b63c6f229 /Python/compile.c | |
parent | cf76be0ae041f1489812786ad90e97b50991c37d (diff) | |
download | cpython-b39903b0a0f1660714939002170d26f020ffc85a.zip cpython-b39903b0a0f1660714939002170d26f020ffc85a.tar.gz cpython-b39903b0a0f1660714939002170d26f020ffc85a.tar.bz2 |
symtable_cellvar_offsets(): This leaked references to little integers
in normal cases, and also in error cases.
Bugfix candidate.
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c index 717b3ff..6616c58 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -4496,7 +4496,8 @@ static int symtable_cellvar_offsets(PyObject **cellvars, int argcount, PyObject *varnames, int flags) { - PyObject *v, *w, *d, *list = NULL; + PyObject *v = NULL; + PyObject *w, *d, *list = NULL; int i, pos; if (flags & CO_VARARGS) @@ -4530,6 +4531,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount, goto fail; if (PyDict_DelItem(*cellvars, PyList_GET_ITEM(list, i)) < 0) goto fail; + Py_DECREF(v); } pos = 0; i = PyList_GET_SIZE(list); @@ -4538,6 +4540,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount, w = PyInt_FromLong(i++); /* don't care about the old key */ if (PyDict_SetItem(d, v, w) < 0) { Py_DECREF(w); + v = NULL; goto fail; } Py_DECREF(w); @@ -4547,6 +4550,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount, return 1; fail: Py_DECREF(d); + Py_XDECREF(v); return -1; } |