summaryrefslogtreecommitdiffstats
path: root/Lib/platform.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-09-17 23:43:01 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-09-17 23:43:01 (GMT)
commitdb01b3e069085b3d24f65eec051f13ba1e392fb7 (patch)
tree387eb40ef82b1ef721750da363ad4431a70c7dc8 /Lib/platform.py
parentca56dd4767617a2f5e946130de4beb06442a5cd5 (diff)
downloadcpython-db01b3e069085b3d24f65eec051f13ba1e392fb7.zip
cpython-db01b3e069085b3d24f65eec051f13ba1e392fb7.tar.gz
cpython-db01b3e069085b3d24f65eec051f13ba1e392fb7.tar.bz2
Issue #27932: Prevent memory leak in win32_ver().
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-xLib/platform.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index 6e264f1..37dfbee 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -567,7 +567,7 @@ def _get_real_winver(maj, min, build):
return maj, min, build
from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer,
- Structure, WinDLL)
+ Structure, WinDLL, _Pointer)
from ctypes.wintypes import DWORD, HANDLE
class VS_FIXEDFILEINFO(Structure):
@@ -586,6 +586,8 @@ def _get_real_winver(maj, min, build):
("dwFileDateMS", DWORD),
("dwFileDateLS", DWORD),
]
+ class PVS_FIXEDFILEINFO(_Pointer):
+ _type_ = VS_FIXEDFILEINFO
kernel32 = WinDLL('kernel32')
version = WinDLL('version')
@@ -611,7 +613,7 @@ def _get_real_winver(maj, min, build):
not ver_block):
return maj, min, build
- pvi = POINTER(VS_FIXEDFILEINFO)()
+ pvi = PVS_FIXEDFILEINFO()
if not version.VerQueryValueW(ver_block, "", byref(pvi), byref(DWORD())):
return maj, min, build