panda: call libusb_free_device_list before libusb_exit (#22162)

pull/22168/head
Dean Lee 4 years ago committed by GitHub
parent c61e7c7898
commit a077b8a566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      selfdrive/boardd/panda.cc

@ -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;
}

Loading…
Cancel
Save