diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-02-24 14:06:47 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-02-24 14:06:47 +0100 |
commit | 2e239aa325aa25999be95b8bf2c59614aefe1bf9 (patch) | |
tree | f0df0a9a93d1115262acf8187103ce81616f3b4a | |
parent | 0a30dc9dc2693ffe9aa54126eb684711d950c3f1 (diff) | |
download | psutil-2e239aa325aa25999be95b8bf2c59614aefe1bf9.tar.gz |
fix #1427: [OSX] Process cmdline() and environ() may erroneously raise OSError on failed malloc().
-rw-r--r-- | HISTORY.rst | 2 | ||||
-rw-r--r-- | psutil/arch/osx/process_info.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index b4f4888d..1f784706 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,6 +12,8 @@ XXXX-XX-XX in order to prevent that. - 1419_: [Windows] Process.environ() raises NotImplementedError when querying a 64-bit process in 32-bit-WoW mode. Now it raises AccessDenied. +- 1427_: [OSX] Process cmdline() and environ() may erroneously raise OSError + on failed malloc(). **Enhancements** diff --git a/psutil/arch/osx/process_info.c b/psutil/arch/osx/process_info.c index 40c79a2c..e5ecbaed 100644 --- a/psutil/arch/osx/process_info.c +++ b/psutil/arch/osx/process_info.c @@ -132,7 +132,7 @@ psutil_get_cmdline(long pid) { procargs = (char *)malloc(argmax); if (NULL == procargs) { - PyErr_SetFromErrno(PyExc_OSError); + PyErr_NoMemory(); goto error; } @@ -226,7 +226,7 @@ psutil_get_environ(long pid) { procargs = (char *)malloc(argmax); if (NULL == procargs) { - PyErr_SetFromErrno(PyExc_OSError); + PyErr_NoMemory(); goto error; } |