summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShreedhar Hardikar <shardikar@pivotal.io>2016-06-14 00:21:45 +0000
committerShreedhar Hardikar <shardikar@pivotal.io>2016-06-14 00:21:45 +0000
commitf6269a6321a41bf6e9490425e1549e24cce225c7 (patch)
tree55f17aa836fd9e220beb9c556b711de93f493daa
parentb856d857b4ba29059b440f65870c6e3f08b7e615 (diff)
downloadpsutil-f6269a6321a41bf6e9490425e1549e24cce225c7.tar.gz
Address PR comments
-rw-r--r--HISTORY.rst1
-rw-r--r--psutil/_psutil_linux.c5
2 files changed, 3 insertions, 3 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index e8a6ed9a..b8521e0a 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -19,6 +19,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
- #797: [Linux] net_if_stats() may raise OSError for certain NIC cards.
- #813: Process.as_dict() should ignore extraneous attribute names which gets
attached to the Process instance.
+- #825: Fix possible double close and use of unopened socket
4.1.0 - 2016-03-12
diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c
index afc71580..fb33c165 100644
--- a/psutil/_psutil_linux.c
+++ b/psutil/_psutil_linux.c
@@ -538,17 +538,16 @@ psutil_net_if_stats(PyObject* self, PyObject* args) {
}
}
- close(sock);
py_retlist = Py_BuildValue("[Oiii]", py_is_up, duplex, speed, mtu);
if (!py_retlist)
- goto error_after_close;
+ goto error;
+ close(sock);
Py_DECREF(py_is_up);
return py_retlist;
error:
if (sock != -1)
close(sock);
-error_after_close:
Py_XDECREF(py_is_up);
PyErr_SetFromErrno(PyExc_OSError);
return NULL;