Index: uspace/drv/bus/usb/ehci/hc.c
===================================================================
--- uspace/drv/bus/usb/ehci/hc.c	(revision a15784655e146c5670ae00131f7aaef9823d465d)
+++ uspace/drv/bus/usb/ehci/hc.c	(revision 1329dc0cfa673b0c8543f9c31a769ea91f26b150)
@@ -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));
