Kaydet (Commit) db01b3e0 authored tarafından Steve Dower's avatar Steve Dower

Issue #27932: Prevent memory leak in win32_ver().

üst ca56dd47
...@@ -567,7 +567,7 @@ def _get_real_winver(maj, min, build): ...@@ -567,7 +567,7 @@ def _get_real_winver(maj, min, build):
return maj, min, build return maj, min, build
from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer, from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer,
Structure, WinDLL) Structure, WinDLL, _Pointer)
from ctypes.wintypes import DWORD, HANDLE from ctypes.wintypes import DWORD, HANDLE
class VS_FIXEDFILEINFO(Structure): class VS_FIXEDFILEINFO(Structure):
...@@ -586,6 +586,8 @@ def _get_real_winver(maj, min, build): ...@@ -586,6 +586,8 @@ def _get_real_winver(maj, min, build):
("dwFileDateMS", DWORD), ("dwFileDateMS", DWORD),
("dwFileDateLS", DWORD), ("dwFileDateLS", DWORD),
] ]
class PVS_FIXEDFILEINFO(_Pointer):
_type_ = VS_FIXEDFILEINFO
kernel32 = WinDLL('kernel32') kernel32 = WinDLL('kernel32')
version = WinDLL('version') version = WinDLL('version')
...@@ -611,7 +613,7 @@ def _get_real_winver(maj, min, build): ...@@ -611,7 +613,7 @@ def _get_real_winver(maj, min, build):
not ver_block): not ver_block):
return maj, min, build return maj, min, build
pvi = POINTER(VS_FIXEDFILEINFO)() pvi = PVS_FIXEDFILEINFO()
if not version.VerQueryValueW(ver_block, "", byref(pvi), byref(DWORD())): if not version.VerQueryValueW(ver_block, "", byref(pvi), byref(DWORD())):
return maj, min, build return maj, min, build
......
...@@ -214,6 +214,8 @@ Tools/Demos ...@@ -214,6 +214,8 @@ Tools/Demos
Windows Windows
------- -------
- Issue #27932: Prevent memory leak in win32_ver().
- Issue #27888: Prevent Windows installer from displaying console windows and - Issue #27888: Prevent Windows installer from displaying console windows and
failing when pip cannot be installed/uninstalled. failing when pip cannot be installed/uninstalled.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment