core: Unset device ctx if it has been destroyed 48/290948/1
authorBenjamin Berg <bberg@redhat.com>
Fri, 4 Feb 2022 21:50:28 +0000 (22:50 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 5 Apr 2023 09:08:52 +0000 (11:08 +0200)
commit7bc9a0a16eff16f6a7f42e5d15021ab3eaf8e7f9
tree77434af08ffe37e0587589f8788a3b20d739a097
parenta53eb1e32b7fad12a2ee82a62be254758ad20f8d
core: Unset device ctx if it has been destroyed

Devices can outlive their context in some cases (in particular with
python garbage collection). Guard against this by clearing the ctx
pointer so that it is not pointing to uninitialized memory.

Closes #1058

[Cherrypick from mainline commit c3639bc ("core: Unset device ctx if it has been destroyed")]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ic1a27aea2b29d07c93d96d98a684facc799b4259
libusb/core.c
libusb/version_nano.h