gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598)

This commit is contained in:
Sergey Miryanov
2025-05-08 04:09:20 -07:00
committed by GitHub
parent 45bb5ba61a
commit 0ec8fc83a8

View File

@@ -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;
}