chrvadala / node-ble

Bluetooth Low Energy (BLE) library written with pure Node.js (no bindings) - baked by Bluez via DBus
https://www.npmjs.com/package/node-ble
MIT License
320 stars 47 forks source link

Fix memory leak in waitDevice method #75

Closed Raffone17 closed 5 days ago

Raffone17 commented 1 month ago

In the waitDevice method, if the device is not found the 'operation timed out' error is thrown but the interval is not cleared. I added a try and finally statements for avoid this problem.

gmacario commented 1 month ago

Hello @chrvadala,

Please let us know when you plan to have a look at this PR by @Raffone17. Thank you!

chrvadala commented 1 month ago

Thanks for this PR guys, can you integrate it with a test? I see that the fix makes completely sense, but it is better to cover this case with a test. You can mock getDevice for that. It seems the easier solution

Raffone17 commented 1 month ago

Hello @chrvadala, I did a unit test that covers the scenario.

Raffone17 commented 2 weeks ago

@chrvadala I made the requested changes.

chrvadala commented 5 days ago

Released with v1.12.0 Thanks @Raffone17 and @gmacario for your help on this project