aboutsummaryrefslogtreecommitdiffstats
path: root/payloads/libpayload/drivers/usb/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/drivers/usb/usb.c')
-rw-r--r--payloads/libpayload/drivers/usb/usb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index d9727f01b..8ee997cec 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -539,10 +539,14 @@ usb_detach_device(hci_t *controller, int devno)
been called yet by the usb class driver */
if (controller->devices[devno]) {
controller->devices[devno]->destroy (controller->devices[devno]);
- free(controller->devices[devno]);
- controller->devices[devno] = NULL;
if (controller->destroy_device)
controller->destroy_device(controller, devno);
+ if (controller->devices[devno]->configuration)
+ free(controller->devices[devno]->configuration);
+ if (controller->devices[devno]->descriptor)
+ free(controller->devices[devno]->descriptor);
+ free(controller->devices[devno]);
+ controller->devices[devno] = NULL;
}
}