]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 73018 via svnmerge from
authorMartin v. Löwis <martin@v.loewis.de>
Fri, 29 May 2009 16:05:08 +0000 (16:05 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Fri, 29 May 2009 16:05:08 +0000 (16:05 +0000)
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.
  ........
................

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

index 2fccfa18203337b8acf6221a7d5e24678c0bb002..5806c0b65ea5d2966c1dfa328aff73520252f69d 100644 (file)
--- 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
index a58cb060a6e92eeadba4f8d928bd53590dc0b81e..a8028198f05f650f0cf43b3e5cbe20e5b30aac90 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 cb99183f27c2bd60e511c471f89ba90666b19b27..200f0f32bc59d0925f0ea6899e768afa0e3b65ba 100644 (file)
@@ -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);