diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-15 06:07:42 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-15 06:07:42 (GMT) |
commit | 68f52178d9a77bb598664a090019f8f971d3de7d (patch) | |
tree | bbca03fa51b719d6b9841d0e1b6d4825cd993874 /Objects | |
parent | 845085703cacab33293898cb183f618d9f580d92 (diff) | |
download | cpython-68f52178d9a77bb598664a090019f8f971d3de7d.zip cpython-68f52178d9a77bb598664a090019f8f971d3de7d.tar.gz cpython-68f52178d9a77bb598664a090019f8f971d3de7d.tar.bz2 |
* Fix the refcount leak in _PySequence_BytesToCharpArray from r78946.
* Also fixes a potential extra DECREF of an arg in the error case within
_posixsubprocess.fork_exec() by not reusing the process_args variable.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 952ad40..cd5a9fd 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2737,6 +2737,7 @@ _PySequence_BytesToCharpArray(PyObject* self) { char **array; Py_ssize_t i, argc; + PyObject *item = NULL; argc = PySequence_Size(self); if (argc == -1) @@ -2749,7 +2750,7 @@ _PySequence_BytesToCharpArray(PyObject* self) } for (i = 0; i < argc; ++i) { char *data; - PyObject *item = PySequence_GetItem(self, i); + item = PySequence_GetItem(self, i); data = PyBytes_AsString(item); if (data == NULL) { /* NULL terminate before freeing. */ @@ -2761,12 +2762,14 @@ _PySequence_BytesToCharpArray(PyObject* self) PyErr_NoMemory(); goto fail; } + Py_DECREF(item); } array[argc] = NULL; return array; fail: + Py_XDECREF(item); _Py_FreeCharPArray(array); return NULL; } |