Commit e6c97dc
fix(i2c): prevent file descriptor leak in SMBus usage
Fix a file descriptor leak in check_for_i2c_device.
SMBus instances were opened without being closed, causing file
descriptors to accumulate over time. In long-running scenarios,
this could reach the system ulimit and trigger:
OSError: [Errno 24] Too many open files
As a result, flight controller boards may fail to be detected
or become inaccessible.
### Changes
- Use context manager (`with SMBus(...) as bus`) to ensure proper cleanup
### Impact
- Prevents FD exhaustion
- Improves reliability of board detection1 parent f069b56 commit e6c97dc
1 file changed
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
0 commit comments