Index: uspace/drv/root/root/root.c
===================================================================
--- uspace/drv/root/root/root.c	(revision eaf4e2fcaae4c25677cb8487333468c6c4e3a0c0)
+++ uspace/drv/root/root/root.c	(revision 85c98af9c152d18ed76d9deec09f62faee163756)
@@ -144,10 +144,11 @@
 
 	/* Null-terminate string. */
-	platform = realloc(platform, platform_size + 1);
-	if (platform == NULL) {
+	char *tmp = realloc(platform, platform_size + 1);
+	if (tmp == NULL) {
 		ddf_msg(LVL_ERROR, "Memory allocation failed.");
-		return ENOMEM;
-	}
-
+		free(platform);
+		return ENOMEM;
+	}
+	platform = tmp;
 	platform[platform_size] = '\0';
 
