Index: uspace/drv/bus/usb/usbmid/explore.c
===================================================================
--- uspace/drv/bus/usb/usbmid/explore.c	(revision 05a119bc6974949bfc4fa29be4efcd72245f813c)
+++ uspace/drv/bus/usb/usbmid/explore.c	(revision 359d96fd2cd98fd2da38c5c6b6ae8505ebfa8c50)
@@ -174,4 +174,5 @@
 	rc = ddf_fun_bind(ctl_fun);
 	if (rc != EOK) {
+		ddf_fun_destroy(ctl_fun);
 		usb_log_error("Failed to bind control function: %s.\n",
 		    str_error(rc));
Index: uspace/drv/bus/usb/usbmid/usbmid.c
===================================================================
--- uspace/drv/bus/usb/usbmid/usbmid.c	(revision 05a119bc6974949bfc4fa29be4efcd72245f813c)
+++ uspace/drv/bus/usb/usbmid/usbmid.c	(revision 359d96fd2cd98fd2da38c5c6b6ae8505ebfa8c50)
@@ -106,12 +106,12 @@
 	    (int) interface_descriptor->interface_number);
 	if (rc < 0) {
-		goto error_leave;
+		return ENOMEM;
 	}
 
 	/* Create the device. */
 	child = ddf_fun_create(parent->ddf_dev, fun_inner, child_name);
+	free(child_name);
 	if (child == NULL) {
-		rc = ENOMEM;
-		goto error_leave;
+		return ENOMEM;
 	}
 
@@ -122,28 +122,18 @@
 
 	rc = usb_device_create_match_ids_from_interface(device_descriptor,
-	    interface_descriptor,
-	    &child->match_ids);
+	    interface_descriptor, &child->match_ids);
 	if (rc != EOK) {
-		goto error_leave;
+		ddf_fun_destroy(child);
+		return rc;
 	}
 
 	rc = ddf_fun_bind(child);
 	if (rc != EOK) {
-		goto error_leave;
+		/* This takes care of match_id deallocation as well. */
+		ddf_fun_destroy(child);
+		return rc;
 	}
 
 	return EOK;
-
-error_leave:
-	if (child != NULL) {
-		child->name = NULL;
-		/* This takes care of match_id deallocation as well. */
-		ddf_fun_destroy(child);
-	}
-	if (child_name != NULL) {
-		free(child_name);
-	}
-
-	return rc;
 }
 
