Index: uspace/app/bdsh/exec.c
===================================================================
--- uspace/app/bdsh/exec.c	(revision 951e451f822f146ef5fabfed0bec74bc29b5e20c)
+++ uspace/app/bdsh/exec.c	(revision c56a3ebdb2a5624e5822b0cbe6bb93a15f81f7d3)
@@ -47,7 +47,4 @@
 #include "errors.h"
 
-/* FIXME: Just have find_command() return an allocated string */
-static char *found;
-
 static char *find_command(char *);
 static int try_access(const char *);
@@ -74,14 +71,12 @@
 static char *find_command(char *cmd)
 {
-	size_t i;
-
-	found = (char *)malloc(PATH_MAX);
-
 	/* The user has specified a full or relative path, just give it back. */
 	if (-1 != try_access(cmd)) {
-		return (char *) cmd;
+		return str_dup(cmd);
 	}
 
+	char *found = (char *)malloc(PATH_MAX);
 	/* We now have n places to look for the command */
+	size_t i;
 	for (i = 0; search_dir[i] != NULL; i++) {
 		memset(found, 0, PATH_MAX);
@@ -91,7 +86,8 @@
 		}
 	}
+	free(found);
 
 	/* We didn't find it, just give it back as-is. */
-	return (char *) cmd;
+	return str_dup(cmd);
 }
 
@@ -107,6 +103,5 @@
 	FILE *files[3];
 
-	tmp = str_dup(find_command(cmd));
-	free(found);
+	tmp = find_command(cmd);
 
 	files[0] = io->stdin;
