Index: uspace/drv/bus/usb/ehci/hc.c
===================================================================
--- uspace/drv/bus/usb/ehci/hc.c	(revision fe97c5e008b48a42440c0aa06001d6f85d4346fe)
+++ uspace/drv/bus/usb/ehci/hc.c	(revision dca8fe53f27f24a08f4a33e3ab1fe70982053f87)
@@ -130,8 +130,12 @@
 	memcpy(code->cmds, ehci_irq_commands, sizeof(ehci_irq_commands));
 	ehci_caps_regs_t *caps = NULL;
+
 	int ret = pio_enable_range(&regs, (void**)&caps);
 	if (ret != EOK) {
+		free(code->ranges);
+		free(code->cmds);
 		return ret;
 	}
+
 	ehci_regs_t *registers =
 	    (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(caps->caplength));
