Skip to content

Commit e0aefbd

Browse files
gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598)
(cherry picked from commit 0ec8fc8) Co-authored-by: Sergey Miryanov <[email protected]>
1 parent a719e5f commit e0aefbd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Python/sysmodule.c

+3
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,9 @@ _sys_getwindowsversion_from_kernel32(void)
16931693
!GetFileVersionInfoW(kernel32_path, 0, verblock_size, verblock) ||
16941694
!VerQueryValueW(verblock, L"", (LPVOID)&ffi, &ffi_len)) {
16951695
PyErr_SetFromWindowsErr(0);
1696+
if (verblock) {
1697+
PyMem_RawFree(verblock);
1698+
}
16961699
return NULL;
16971700
}
16981701

0 commit comments

Comments
 (0)