[Python-checkins] r73016 - in python/trunk: Misc/NEWS Modules/grpmodule.c Modules/pwdmodule.c

martin.v.loewis python-checkins at python.org
Fri May 29 17:58:08 CEST 2009


Author: martin.v.loewis
Date: Fri May 29 17:58:08 2009
New Revision: 73016
Log:
Issue #4873: Fix resource leaks in error cases of pwd and grp.
Modified:
 python/trunk/Misc/NEWS
 python/trunk/Modules/grpmodule.c
 python/trunk/Modules/pwdmodule.c
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Fri May 29 17:58:08 2009
@@ -1067,6 +1067,8 @@
 Extension Modules
 -----------------
 
+- Issue #4873: Fix resource leaks in error cases of pwd and grp.
+
 - Issue #4751: For hashlib algorithms provided by OpenSSL, the Python
 GIL is now released during computation on data lengths >= 2048 bytes.
 
Modified: python/trunk/Modules/grpmodule.c
==============================================================================
--- python/trunk/Modules/grpmodule.c	(original)
+++ python/trunk/Modules/grpmodule.c	Fri May 29 17:58:08 2009
@@ -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);
Modified: python/trunk/Modules/pwdmodule.c
==============================================================================
--- python/trunk/Modules/pwdmodule.c	(original)
+++ python/trunk/Modules/pwdmodule.c	Fri May 29 17:58:08 2009
@@ -160,6 +160,7 @@
 		if (v == NULL || PyList_Append(d, v) != 0) {
 			Py_XDECREF(v);
 			Py_DECREF(d);
+			endpwent();
 			return NULL;
 		}
 		Py_DECREF(v);


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /