Skip to content

Commit bc92eba

Browse files
committed
Close lib to avoid segmentation fault
1 parent cbdd2e8 commit bc92eba

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/inputstreamhelper/widevine/widevine.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,18 @@ def ia_cdm_path():
127127

128128
def get_lib_version(path):
129129
"""
130-
Determines version of the Widevine library.
130+
Determines version of the Widevine library using the python ctypes module.
131131
Returns empty string if not possible, which might indicate a problematic file/arch mismatch, so this can be used as a check.
132132
"""
133133
from ctypes import CDLL, c_char_p
134+
from _ctypes import dlclose
134135

135136
lib_version = ''
136137
try:
137138
lib = CDLL(compat_path(path))
138139
lib.GetCdmVersion.restype = c_char_p
139140
lib_version = to_unicode(lib.GetCdmVersion())
141+
dlclose(lib._handle) # pylint: disable=protected-access
140142
except (OSError, AttributeError) as exc:
141143
log(4, 'Failed to determine lib version: ' + str(exc))
142144

tests/xbmcvfs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ def rmdir(path):
8787
def translatePath(path):
8888
"""A stub implementation of the xbmc translatePath() function"""
8989
if path.startswith('special://home'):
90-
return path.replace('special://home', os.path.join(os.getcwd(), 'tests/'))
90+
return path.replace('special://home', os.path.join(os.getcwd(), 'tests'))
9191
if path.startswith('special://masterprofile'):
92-
return path.replace('special://masterprofile', os.path.join(os.getcwd(), 'tests/userdata/'))
92+
return path.replace('special://masterprofile', os.path.join(os.getcwd(), 'tests/userdata'))
9393
if path.startswith('special://profile'):
94-
return path.replace('special://profile', os.path.join(os.getcwd(), 'tests/userdata/'))
94+
return path.replace('special://profile', os.path.join(os.getcwd(), 'tests/userdata'))
9595
if path.startswith('special://userdata'):
96-
return path.replace('special://userdata', os.path.join(os.getcwd(), 'tests/userdata/'))
96+
return path.replace('special://userdata', os.path.join(os.getcwd(), 'tests/userdata'))
9797
return path

0 commit comments

Comments
 (0)