diff options
author | Sergey Miryanov <sergey.miryanov@gmail.com> | 2025-05-08 04:09:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-08 12:09:20 +0100 |
commit | 0ec8fc83a83914d2ae97e52529e98ce63aaf831c (patch) | |
tree | 36785d6865c2db13013d4a3fe68a20746a12fd7e /Python | |
parent | 45bb5ba61a8d6dcaa44312b67fe6bade5e2ad992 (diff) | |
download | cpython-0ec8fc83a83914d2ae97e52529e98ce63aaf831c.tar.gz cpython-0ec8fc83a83914d2ae97e52529e98ce63aaf831c.zip |
gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/sysmodule.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 00dce4527fb..41b9a6b276a 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; } |