https://github.com/python/cpython/commit/e0aefbd263c36b84bc98cd92f3ae3ac871e73bcd
commit: e0aefbd263c36b84bc98cd92f3ae3ac871e73bcd
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: zooba <[email protected]>
date: 2025-05-08T11:32:59Z
summary:

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 <[email protected]>

files:
M Python/sysmodule.c

diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 80d1bf3b914e37..4b7f0cc68daadb 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;
     }
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to