Index: kernel/generic/src/console/kconsole.c
===================================================================
--- kernel/generic/src/console/kconsole.c	(revision aae365bc823f3137811d2c48089c150e81c40606)
+++ kernel/generic/src/console/kconsole.c	(revision be6e37a1450dc9ae009c1198f1541fa2c80b2a0c)
@@ -219,8 +219,14 @@
 	const char *hint;
 	const char *help;
-	char *output = nfmalloc(MAX_CMDLINE);
 	size_t hints_to_show = MAX_TAB_HINTS - 1;
 	size_t total_hints_shown = 0;
 	bool continue_showing_hints = true;
+
+	char *output = malloc(MAX_CMDLINE);
+	if (!output) {
+		// TODO: fix the function so that it does not need allocation
+		printf("Can't complete command, out of memory.\n");
+		return 0;
+	}
 
 	output[0] = 0;
@@ -325,5 +331,6 @@
 }
 
-NO_TRACE static wchar_t *clever_readline(const char *prompt, indev_t *indev)
+NO_TRACE static wchar_t *clever_readline(const char *prompt, indev_t *indev,
+    char *tmp)
 {
 	printf("%s> ", prompt);
@@ -332,5 +339,4 @@
 	wchar_t *current = history[history_pos];
 	current[0] = 0;
-	char *tmp = nfmalloc(STR_BOUNDS(MAX_CMDLINE));
 
 	while (true) {
@@ -534,5 +540,4 @@
 	}
 
-	free(tmp);
 	return current;
 }
@@ -809,7 +814,16 @@
 		printf("Type \"exit\" to leave the console.\n");
 
-	char *cmdline = nfmalloc(STR_BOUNDS(MAX_CMDLINE));
+	char *buffer = malloc(STR_BOUNDS(MAX_CMDLINE));
+	char *cmdline = malloc(STR_BOUNDS(MAX_CMDLINE));
+	if (!buffer || !cmdline) {
+		// TODO: fix the function so that it does not need allocations
+		printf("Can't start console, out of memory.\n");
+		free(buffer);
+		free(cmdline);
+		return;
+	}
+
 	while (true) {
-		wchar_t *tmp = clever_readline((char *) prompt, stdin);
+		wchar_t *tmp = clever_readline((char *) prompt, stdin, buffer);
 		size_t len = wstr_length(tmp);
 		if (!len)
@@ -827,4 +841,5 @@
 		(void) cmd_info->func(cmd_info->argv);
 	}
+	free(buffer);
 	free(cmdline);
 }
