diff options
| author | Georg Brandl <georg@python.org> | 2006-06-04 22:15:45 +0000 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2006-06-04 22:15:45 +0000 |
| commit | bf1f7683ab7d1ec9efcf4a1422d2ebc0d6d0130c (patch) | |
| tree | 1eb6f6c6b9e5139c43c49f7f21e1c7e7a3519e07 /PC | |
| parent | 02647d411a6a310f43501f56f7223e3a602c2bcd (diff) | |
| download | cpython-git-bf1f7683ab7d1ec9efcf4a1422d2ebc0d6d0130c.tar.gz | |
Bug #1500293: fix memory leaks in _subprocess module.
(backport from rev. 46651)
Diffstat (limited to 'PC')
| -rw-r--r-- | PC/_subprocess.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c index 61544c3234..ddaef5ca34 100644 --- a/PC/_subprocess.c +++ b/PC/_subprocess.c @@ -247,19 +247,23 @@ static int getint(PyObject* obj, char* name) { PyObject* value; + int ret; value = PyObject_GetAttrString(obj, name); if (! value) { PyErr_Clear(); /* FIXME: propagate error? */ return 0; } - return (int) PyInt_AsLong(value); + ret = (int) PyInt_AsLong(value); + Py_DECREF(value); + return ret; } static HANDLE gethandle(PyObject* obj, char* name) { sp_handle_object* value; + HANDLE ret; value = (sp_handle_object*) PyObject_GetAttrString(obj, name); if (! value) { @@ -267,8 +271,11 @@ gethandle(PyObject* obj, char* name) return NULL; } if (value->ob_type != &sp_handle_type) - return NULL; - return value->handle; + ret = NULL; + else + ret = value->handle; + Py_DECREF(value); + return ret; } static PyObject* |
