summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2025-05-08 11:32:59 (GMT)
committerGitHub <noreply@github.com>2025-05-08 11:32:59 (GMT)
commite0aefbd263c36b84bc98cd92f3ae3ac871e73bcd (patch)
treee585e2412c160b737605caa27365da74d93b3b22 /Python/sysmodule.c
parenta719e5fbb63346c751fc9dfbc62af32215f6c0be (diff)
downloadcpython-e0aefbd263c36b84bc98cd92f3ae3ac871e73bcd.zip
cpython-e0aefbd263c36b84bc98cd92f3ae3ac871e73bcd.tar.gz
cpython-e0aefbd263c36b84bc98cd92f3ae3ac871e73bcd.tar.bz2
gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 (GH-133598)
(cherry picked from commit 0ec8fc83a83914d2ae97e52529e98ce63aaf831c) Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 80d1bf3..4b7f0cc 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1693,6 +1693,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;
}