https://github.com/python/cpython/commit/0ec8fc83a83914d2ae97e52529e98ce63aaf831c commit: 0ec8fc83a83914d2ae97e52529e98ce63aaf831c branch: main author: Sergey Miryanov <sergey.mirya...@gmail.com> committer: zooba <steve.do...@microsoft.com> date: 2025-05-08T12:09:20+01:00 summary:
gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598) files: M Python/sysmodule.c diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 00dce4527fbb90..41b9a6b276a3b1 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1670,6 +1670,9 @@ _sys_getwindowsversion_from_kernel32(void) !GetFileVersionInfoW(kernel32_path, 0, verblock_size, verblock) || !VerQueryValueW(verblock, L"", (LPVOID)&ffi, &ffi_len)) { PyErr_SetFromWindowsErr(0); + if (verblock) { + PyMem_RawFree(verblock); + } return NULL; } _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com