Commit 4f16d3b4 authored by Martin v. Löwis's avatar Martin v. Löwis

Issue #4873: Fix resource leaks in error cases of pwd and grp.

parent 3e3eace7
...@@ -1067,6 +1067,8 @@ C-API ...@@ -1067,6 +1067,8 @@ C-API
Extension Modules Extension Modules
----------------- -----------------
- Issue #4873: Fix resource leaks in error cases of pwd and grp.
- Issue #4751: For hashlib algorithms provided by OpenSSL, the Python - Issue #4751: For hashlib algorithms provided by OpenSSL, the Python
GIL is now released during computation on data lengths >= 2048 bytes. GIL is now released during computation on data lengths >= 2048 bytes.
......
...@@ -76,7 +76,6 @@ mkgrent(struct group *p) ...@@ -76,7 +76,6 @@ mkgrent(struct group *p)
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
Py_DECREF(v); Py_DECREF(v);
Py_DECREF(w);
return NULL; return NULL;
} }
...@@ -139,6 +138,7 @@ grp_getgrall(PyObject *self, PyObject *ignore) ...@@ -139,6 +138,7 @@ grp_getgrall(PyObject *self, PyObject *ignore)
if (v == NULL || PyList_Append(d, v) != 0) { if (v == NULL || PyList_Append(d, v) != 0) {
Py_XDECREF(v); Py_XDECREF(v);
Py_DECREF(d); Py_DECREF(d);
endgrent();
return NULL; return NULL;
} }
Py_DECREF(v); Py_DECREF(v);
......
...@@ -160,6 +160,7 @@ pwd_getpwall(PyObject *self) ...@@ -160,6 +160,7 @@ pwd_getpwall(PyObject *self)
if (v == NULL || PyList_Append(d, v) != 0) { if (v == NULL || PyList_Append(d, v) != 0) {
Py_XDECREF(v); Py_XDECREF(v);
Py_DECREF(d); Py_DECREF(d);
endpwent();
return NULL; return NULL;
} }
Py_DECREF(v); Py_DECREF(v);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment