Merge pull request #44 from ajeddeloh/fix-invalid-free

rootdev: do not malloc/free entry from readdir
diff --git a/src/rootdev/rootdev.c b/src/rootdev/rootdev.c
index 807f6e8..4998a23 100644
--- a/src/rootdev/rootdev.c
+++ b/src/rootdev/rootdev.c
@@ -129,15 +129,6 @@
     return found;
   }
 
-  /* Allocate a properly sized entry. */
-  entry = malloc(offsetof(struct dirent, d_name) + working_path_size);
-  if (!entry) {
-    warn("malloc(dirent)");
-    free(working_path);
-    closedir(dirp);
-    return found;
-  }
-
   while ((entry = readdir(dirp)) != NULL) {
     size_t candidate_len = strlen(entry->d_name);
     size_t path_len = 0;
@@ -187,7 +178,6 @@
   }
 
   free(working_path);
-  free(entry);
   closedir(dirp);
   return found;
 }