From e6f5f498d508335f359cd2d01a1098afcbcb1b6c Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Wed, 3 May 2017 19:32:17 +0200 Subject: [PATCH] fix 1050: memory leak in memory_maps() on Windows because we forgot to Py_DECREF --- HISTORY.rst | 1 + psutil/_psutil_windows.c | 1 + 2 files changed, 2 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 67213b2ca..c193dfc8c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -37,6 +37,7 @@ None - 1046_: [Windows] disk_partitions() on Windows overrides user's SetErrorMode. - 1047_: [Windows] Process username(): memory leak in case exception is thrown. +- 1050_: [Windows] Process.memory_maps memory() leaks memory. *2017-04-10* diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 69d1fdfda..20d20b824 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -2920,6 +2920,7 @@ psutil_proc_memory_maps(PyObject *self, PyObject *args) { if (PyList_Append(py_retlist, py_tuple)) goto error; Py_DECREF(py_tuple); + Py_DECREF(py_str); } previousAllocationBase = basicInfo.AllocationBase; baseAddress = (PCHAR)baseAddress + basicInfo.RegionSize;