Index: Modules/grpmodule.c =================================================================== --- Modules/grpmodule.c (revision 68342) +++ Modules/grpmodule.c (working copy) @@ -76,7 +76,6 @@ if (PyErr_Occurred()) { Py_DECREF(v); - Py_DECREF(w); return NULL; } @@ -139,6 +138,7 @@ if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); + endgrent(); return NULL; } Py_DECREF(v); Index: Modules/pwdmodule.c =================================================================== --- Modules/pwdmodule.c (revision 68342) +++ Modules/pwdmodule.c (working copy) @@ -163,6 +163,7 @@ if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); + endpwent(); return NULL; } Py_DECREF(v);