Index: uspace/drv/infrastructure/root/root.c
===================================================================
--- uspace/drv/infrastructure/root/root.c	(revision c01bb5f96a155bdec60146b151e214e7cd17f2c4)
+++ uspace/drv/infrastructure/root/root.c	(revision f943dd3a2cd9254e12af5d91b1f7097a2c5a6870)
@@ -158,6 +158,9 @@
 	if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) {
 		ddf_msg(LVL_ERROR, "Memory allocation failed.");
-		return ENOMEM;
-	}
+		free(platform);
+		return ENOMEM;
+	}
+
+	free(platform);
 
 	/* Add function. */
@@ -169,4 +172,5 @@
 	if (fun == NULL) {
 		ddf_msg(LVL_ERROR, "Error creating function %s", name);
+		free(match_id);
 		return ENOMEM;
 	}
@@ -176,4 +180,5 @@
 		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
 		    name);
+		free(match_id);
 		ddf_fun_destroy(fun);
 		return rc;
@@ -208,5 +213,5 @@
 	 * vital for the system.
 	 */
-	add_virtual_root_fun(dev);
+	(void) add_virtual_root_fun(dev);
 
 	/* Register root device's children. */
