cheery / node-udev

Bindings to libudev
35 stars 31 forks source link

fix bad udev_device_get_parent unref #38

Closed alejandroclaro closed 2 years ago

alejandroclaro commented 2 years ago

udev_device_get_parent return a pointer to the parent device. No additional reference to this device is acquired, but the child device owns a reference to such a parent device. On failure, NULL is returned.

unreferencing the pointer returned by udev_device_get_parent is incorrect, and abort the program in some version of libudev due to a failing assertion:

Assertion 'p->n_ref > 0' failed at src/libudev/libudev-device.c:502, function udev_device_unref. Aborting.