balena-io-modules / drivelist

List all connected drives in your computer, in all major operating systems
Apache License 2.0
242 stars 90 forks source link

Fix mac os crash #337

Closed zrzka closed 5 years ago

zrzka commented 5 years ago

This PR:

Why this worked before? Because of memory leak, _disk was alive and then context pointer in the appendDisk callback was still valid. But now, since we're properly releasing the _disk, it can be invalid if we keep appendDisk callback around, because context can point to a garbage.