Skip to content

Commit 0ec8fc8

Browse files
gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598)
1 parent 45bb5ba commit 0ec8fc8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Python/sysmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,9 @@ _sys_getwindowsversion_from_kernel32(void)
16701670
!GetFileVersionInfoW(kernel32_path, 0, verblock_size, verblock) ||
16711671
!VerQueryValueW(verblock, L"", (LPVOID)&ffi, &ffi_len)) {
16721672
PyErr_SetFromWindowsErr(0);
1673+
if (verblock) {
1674+
PyMem_RawFree(verblock);
1675+
}
16731676
return NULL;
16741677
}
16751678

0 commit comments

Comments
 (0)