Skip to content

Commit

Permalink
Merge pull request pyinstaller#2026 from stephenrauch/close-pe-object
Browse files Browse the repository at this point in the history
Close PE() object to avoid mmap memory leak
  • Loading branch information
bjones1 committed Jun 4, 2016
2 parents 192ccc2 + 1f59bd9 commit 552ac37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PyInstaller/depend/bindepend.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def _getImports_pe(pth):
dll, _ = forwarder.split('.')
dlls.add(dll + ".dll")

pe.close()
return dlls


Expand Down Expand Up @@ -187,10 +188,13 @@ def matchDLLArch(filename):
if _exe_machine_type is None:
exe_pe = pefile.PE(sys.executable, fast_load=True)
_exe_machine_type = exe_pe.FILE_HEADER.Machine
exe_pe.close()

pe = pefile.PE(filename, fast_load=True)

return pe.FILE_HEADER.Machine == _exe_machine_type
match_arch = pe.FILE_HEADER.Machine == _exe_machine_type
pe.close()
return match_arch

def Dependencies(lTOC, xtrapath=None, manifest=None, redirects=None):
"""
Expand Down
1 change: 1 addition & 0 deletions PyInstaller/utils/win32/versioninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def pefile_read_version(filename):
print(dir(pe.VS_FIXEDFILEINFO))
print(repr(pe.VS_FIXEDFILEINFO))
print(pe.dump_info())
pe.close()
return vers


Expand Down

0 comments on commit 552ac37

Please sign in to comment.