]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32...
authorSergey Miryanov <sergey.miryanov@gmail.com>
Thu, 8 May 2025 11:09:20 +0000 (04:09 -0700)
committerGitHub <noreply@github.com>
Thu, 8 May 2025 11:09:20 +0000 (12:09 +0100)
Python/sysmodule.c

index 00dce4527fbb90d634e9cf31522819ca8bd0bdea..41b9a6b276a3b1ae2e347bc3606798d3ffc5bfca 100644 (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;
     }