darwin: release device parent reference when re-enumerating device
This commit fixes a dangling device reference that can occur when a device is
being re-enumerated. The problem is the code was unconditionally re-caching the
parent device which then takes a reference on the parent device. If the field
was already populated this reference was not needed. To ensure the code works
even if the parent device also changes during the re-enumeration the code
release the parent reference and grabs a fresh reference.
Fixes #924
Signed-off-by: Nathan Hjelm <hjelmn@google.com>
2 files changed