mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-07 22:52:06 +08:00
panda: call libusb_free_device_list before libusb_exit (#22162)
old-commit-hash: a077b8a566c27d3625047c0f165b75906df45cff
This commit is contained in:
@@ -82,10 +82,10 @@ Panda::Panda(std::string serial) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
cleanup();
|
||||
if (dev_list != NULL) {
|
||||
libusb_free_device_list(dev_list, 1);
|
||||
}
|
||||
cleanup();
|
||||
throw std::runtime_error("Error connecting to panda");
|
||||
}
|
||||
|
||||
@@ -138,12 +138,12 @@ std::vector<std::string> Panda::list() {
|
||||
}
|
||||
|
||||
finish:
|
||||
if (context) {
|
||||
libusb_exit(context);
|
||||
}
|
||||
if (dev_list != NULL) {
|
||||
libusb_free_device_list(dev_list, 1);
|
||||
}
|
||||
if (context) {
|
||||
libusb_exit(context);
|
||||
}
|
||||
return serials;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user