Skip to content

Commit 5cdf8af

Browse files
authored
Merge pull request #88 from fpdotmonkey/bugfix/check_dt_compatible_value_memory_leak
Fixed an issue where `__init__.check_dt_compatible_value` opened a file…
2 parents 1b43d2a + e2f1b67 commit 5cdf8af

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adafruit_platformdetect/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ def check_dt_compatible_value(self, value):
6262
"""
6363
# Match a value like 'qcom,apq8016-sbc':
6464
try:
65-
if value in open("/proc/device-tree/compatible").read():
66-
return True
65+
with open("/proc/device-tree/compatible") as compatible:
66+
if value in compatible.read():
67+
return True
6768
except FileNotFoundError:
6869
pass
6970

0 commit comments

Comments
 (0)