summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-05-29 16:00:23 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2009-05-29 16:00:23 (GMT)
commit416b262343d63ddabd103b58f04e58243b681fac (patch)
treecdb37c0f3dcb3069ebe000b230c4bb77eebec2c2
parentba130b825d5634560ab4d3aeb53873040ed019f1 (diff)
downloadcpython-416b262343d63ddabd103b58f04e58243b681fac.zip
cpython-416b262343d63ddabd103b58f04e58243b681fac.tar.gz
cpython-416b262343d63ddabd103b58f04e58243b681fac.tar.bz2
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. ........
-rw-r--r--Misc/NEWS5
-rw-r--r--Modules/grpmodule.c2
-rw-r--r--Modules/pwdmodule.c1
3 files changed, 7 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 5b0f818..79d7f0e 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -108,6 +108,11 @@ Library
makeunicodedata.py and regenerated the Unicode database (This fixes
u'\u1d79'.lower() == '\x00').
+Extension Modules
+-----------------
+
+- Issue #4873: Fix resource leaks in error cases of pwd and grp.
+
Build
-----
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
index e5b9f47..ffb451e 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 9e01f48..a271c5a 100644
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -160,6 +160,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);