diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-14 12:49:26 -0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-14 12:49:26 -0800 |
commit | bc0168ad4a5467ab369f120e646fda811175b210 (patch) | |
tree | 152c14a8720bc83da5db3c4fdc91d70cab9d51f2 /psutil/_psutil_windows.c | |
parent | 346999344bf94084e9bed09457abe18260d3bfd1 (diff) | |
download | psutil-bc0168ad4a5467ab369f120e646fda811175b210.tar.gz |
properly cleanup C thread
Diffstat (limited to 'psutil/_psutil_windows.c')
-rw-r--r-- | psutil/_psutil_windows.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 3bd07f68..9985e1d3 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -581,7 +581,7 @@ psutil_GetProcWsetInformation( SIZE_T bufferSize; bufferSize = 0x8000; - buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bufferSize); + buffer = MALLOC_ZERO(bufferSize); while ((status = NtQueryVirtualMemory( hProcess, @@ -591,16 +591,15 @@ psutil_GetProcWsetInformation( bufferSize, NULL)) == STATUS_INFO_LENGTH_MISMATCH) { - HeapFree(GetProcessHeap(), 0, buffer); + FREE(buffer); bufferSize *= 2; - psutil_debug("NtQueryVirtualMemory increase bufsize %i", bufferSize); // Fail if we're resizing the buffer to something very large. if (bufferSize > 256 * 1024 * 1024) { PyErr_SetString(PyExc_RuntimeError, "NtQueryVirtualMemory bufsize is too large"); return 1; } - buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bufferSize); + buffer = MALLOC_ZERO(bufferSize); } if (!NT_SUCCESS(status)) { |