Fix memory leaks closing v1 hardware.
[fw/stlink] / src / stlink-sg.c
index b6ac4963bf7cf8b3ec1c3d8a19f6a9ab1894cc7b..062e83dbdbeb4bc2993fece091cf4f29fbd442d3 100644 (file)
@@ -111,6 +111,8 @@ static void clear_cdb(struct stlink_libsg *sl) {
  */void _stlink_sg_close(stlink_t *sl) {
     if (sl) {
         struct stlink_libsg *slsg = sl->backend_data;
+        libusb_close(slsg->usb_handle);
+        libusb_exit(slsg->libusb_ctx);
         free(slsg);
     }
 }