Commit b6eb27a4 authored by Tim Peters's avatar Tim Peters

symtable_cellvar_offsets(): This leaked references to little integers

in normal cases, and also in error cases.

Bugfix candidate.
parent aad3e79c
...@@ -4496,7 +4496,8 @@ static int ...@@ -4496,7 +4496,8 @@ static int
symtable_cellvar_offsets(PyObject **cellvars, int argcount, symtable_cellvar_offsets(PyObject **cellvars, int argcount,
PyObject *varnames, int flags) PyObject *varnames, int flags)
{ {
PyObject *v, *w, *d, *list = NULL; PyObject *v = NULL;
PyObject *w, *d, *list = NULL;
int i, pos; int i, pos;
if (flags & CO_VARARGS) if (flags & CO_VARARGS)
...@@ -4530,6 +4531,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount, ...@@ -4530,6 +4531,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount,
goto fail; goto fail;
if (PyDict_DelItem(*cellvars, PyList_GET_ITEM(list, i)) < 0) if (PyDict_DelItem(*cellvars, PyList_GET_ITEM(list, i)) < 0)
goto fail; goto fail;
Py_DECREF(v);
} }
pos = 0; pos = 0;
i = PyList_GET_SIZE(list); i = PyList_GET_SIZE(list);
...@@ -4538,6 +4540,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount, ...@@ -4538,6 +4540,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount,
w = PyInt_FromLong(i++); /* don't care about the old key */ w = PyInt_FromLong(i++); /* don't care about the old key */
if (PyDict_SetItem(d, v, w) < 0) { if (PyDict_SetItem(d, v, w) < 0) {
Py_DECREF(w); Py_DECREF(w);
v = NULL;
goto fail; goto fail;
} }
Py_DECREF(w); Py_DECREF(w);
...@@ -4547,6 +4550,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount, ...@@ -4547,6 +4550,7 @@ symtable_cellvar_offsets(PyObject **cellvars, int argcount,
return 1; return 1;
fail: fail:
Py_DECREF(d); Py_DECREF(d);
Py_XDECREF(v);
return -1; return -1;
} }
......
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