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/Modules/grpmodule.c b/Modules/grpmodule.c
index e642731..0dcef06 100644
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -79,7 +79,6 @@
 
     if (PyErr_Occurred()) {
         Py_DECREF(v);
-        Py_DECREF(w);
         return NULL;
     }
 
@@ -145,6 +144,7 @@
         if (v == NULL || PyList_Append(d, v) != 0) {
             Py_XDECREF(v);
             Py_DECREF(d);
+            endgrent();
             return NULL;
         }
         Py_DECREF(v);