panda: fix dev_list may be freed twice on failure (#22161)

old-commit-hash: 83cd67ddb5a7f8fc649d38aa24130e38f230fe69
This commit is contained in:
Dean Lee
2021-09-08 06:12:38 +08:00
committed by GitHub
parent 7fc6a76f04
commit 31adaa3906
+1
View File
@@ -59,6 +59,7 @@ Panda::Panda(std::string serial) {
}
if (dev_handle == NULL) goto fail;
libusb_free_device_list(dev_list, 1);
dev_list = nullptr;
if (libusb_kernel_driver_active(dev_handle, 0) == 1) {
libusb_detach_kernel_driver(dev_handle, 0);