]> granicus.if.org Git - python/commitdiff
Merged revisions 73016 via svnmerge from
authorMartin v. Löwis <martin@v.loewis.de>
Fri, 29 May 2009 16:00:23 +0000 (16:00 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Fri, 29 May 2009 16:00:23 +0000 (16:00 +0000)
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.
........

Misc/NEWS
Modules/grpmodule.c
Modules/pwdmodule.c

index 5b0f81841e74ec825b26930b508a265eb0c51244..79d7f0e0b4f20b76dcbe59d1b9a106f3a6fc7ab9 100644 (file)
--- 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
 -----
 
index e5b9f4708c67879bdaf21f5ea5e822940ee68541..ffb451e1744388bd7f82fb88f304617c7d4499c1 100644 (file)
@@ -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);
index 9e01f4875768fd957e7045a8d2c895875b1d8c76..a271c5a82ebc5267f566bb6c161963afebc0ef10 100644 (file)
@@ -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);