diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-24 22:16:49 -0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-24 22:16:49 -0800 |
commit | c9a1e048b759c8f182bcd64cb801a3f100636621 (patch) | |
tree | 9fd94140ccf823763ba259cacb85406e1b77d1ae | |
parent | 89696d6fc8b1e1bbd62218c06aab36c9bf81de74 (diff) | |
download | psutil-c9a1e048b759c8f182bcd64cb801a3f100636621.tar.gz |
use PID converter
-rw-r--r-- | psutil/_psutil_windows.c | 2 | ||||
-rw-r--r-- | psutil/arch/windows/socks.c | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 1dee658c..649e69fa 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -756,7 +756,7 @@ psutil_proc_suspend_or_resume(PyObject *self, PyObject *args) { static PyObject * psutil_proc_threads(PyObject *self, PyObject *args) { - HANDLE hThread; + HANDLE hThread = NULL; THREADENTRY32 te32 = {0}; pid_t pid; int pid_return; diff --git a/psutil/arch/windows/socks.c b/psutil/arch/windows/socks.c index 0da0852b..baacd6c4 100644 --- a/psutil/arch/windows/socks.c +++ b/psutil/arch/windows/socks.c @@ -126,7 +126,7 @@ psutil_net_connections(PyObject *self, PyObject *args) { CHAR addressBufferLocal[65]; CHAR addressBufferRemote[65]; - PyObject *py_retlist; + PyObject *py_retlist = NULL; PyObject *py_conn_tuple = NULL; PyObject *py_af_filter = NULL; PyObject *py_type_filter = NULL; @@ -137,9 +137,10 @@ psutil_net_connections(PyObject *self, PyObject *args) { PyObject *_SOCK_STREAM = PyLong_FromLong((long)SOCK_STREAM); PyObject *_SOCK_DGRAM = PyLong_FromLong((long)SOCK_DGRAM); - // Import some functions. - if (! PyArg_ParseTuple(args, "lOO", &pid, &py_af_filter, &py_type_filter)) + if (! PyArg_ParseTuple(args, "O&OO", Py_PidConverter, &pid, &py_af_filter, + &py_type_filter)) { goto error; + } if (!PySequence_Check(py_af_filter) || !PySequence_Check(py_type_filter)) { psutil_conn_decref_objs(); |