Index: uspace/drv/infrastructure/root/root.c
===================================================================
--- uspace/drv/infrastructure/root/root.c	(revision 827ec41a8ee988c81ee65c62bf4f583429654a68)
+++ uspace/drv/infrastructure/root/root.c	(revision 314f3a3cd09312ebdb951117ae013c07db6ab4be)
@@ -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. */
