From: Martin v. Löwis Date: Fri, 29 May 2009 16:05:08 +0000 (+0000) Subject: Merged revisions 73018 via svnmerge from X-Git-Tag: 3.0~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=49be804b506f8fa7e8789f4b94f5b9ee68e7d7fc;p=thirdparty%2FPython%2Fcpython.git Merged revisions 73018 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r73018 | martin.v.loewis | 2009-05-29 18:01:34 +0200 (Fr, 29 Mai 2009) | 9 lines Merged revisions 73016 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r73016 | martin.v.loewis | 2009-05-29 17:58:08 +0200 (Fr, 29 Mai 2009) | 2 lines Issue #4873: Fix resource leaks in error cases of pwd and grp. ........ ................ --- diff --git a/Misc/NEWS b/Misc/NEWS index 2fccfa182033..5806c0b65ea5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -180,6 +180,8 @@ Library Extension Modules ----------------- +- Issue #4873: Fix resource leaks in error cases of pwd and grp. + - Issue #6093: Fix off-by-one error in locale.strxfrm. Build diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index a58cb060a6e9..a8028198f05f 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -76,7 +76,6 @@ mkgrent(struct group *p) if (PyErr_Occurred()) { Py_DECREF(v); - Py_DECREF(w); return NULL; } @@ -139,6 +138,7 @@ grp_getgrall(PyObject *self, PyObject *ignore) if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); + endgrent(); return NULL; } Py_DECREF(v); diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index cb99183f27c2..200f0f32bc59 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -163,6 +163,7 @@ pwd_getpwall(PyObject *self) if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); + endpwent(); return NULL; } Py_DECREF(v);