summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/usb/usbhid.c
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2018-02-10 12:03:58 +0100
committerNico Huber <nico.h@gmx.de>2018-10-01 16:58:29 +0000
commit1fea734e540ed84e93356381db9d694659477132 (patch)
tree88d2b939713f7ede4f94bd0783d6c1c2ba821f43 /payloads/libpayload/drivers/usb/usbhid.c
parentd5a70bdfd5b09d8438b8883e72f02f0d11d90e0e (diff)
libpayload/drivers/usb: Fix leaks
Don't leak buffers on device detach. Tested on qemu using: qemu-system-x86_64 -bios build/coreboot.rom -M pc -m 2048 -usb \ -device usb-ehci,id=ehci -device usb-mouse -device usb-audio,bus=usb-bus.0 \ -device usb-bt-dongle,bus=usb-bus.0 -device usb-kbd Change-Id: Ib2d80dd4590aa0dacdf2da3b614c6505c931d0be Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/23689 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/drivers/usb/usbhid.c')
-rw-r--r--payloads/libpayload/drivers/usb/usbhid.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/usb/usbhid.c b/payloads/libpayload/drivers/usb/usbhid.c
index 67aebb2ffd..22ed8e7885 100644
--- a/payloads/libpayload/drivers/usb/usbhid.c
+++ b/payloads/libpayload/drivers/usb/usbhid.c
@@ -80,6 +80,9 @@ usb_hid_destroy (usbdev_t *dev)
&dev->endpoints[i], HID_INST(dev)->queue);
HID_INST(dev)->queue = NULL;
}
+ free(HID_INST(dev)->descriptor);
+ HID_INST(dev)->descriptor = NULL;
+
free (dev->data);
}