Diff between 5aa0dd42f7b45b5ef2bceb8510aeb2a892866abf and 80c56880c8f7d1958f66142750908e819e234968

Changed Files

File Additions Deletions Status
src/shared/shell.c +7 -1 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 7417e7a..9cd8d25 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -645,10 +645,16 @@ static char *cmd_generator(const char *text, int state)
 	cmd = find_cmd(text + strlen(menu->name) + 1, menu->entries, &index);
 	if (cmd) {
 		int err;
+		char *tmp;
+
+		err = asprintf(&tmp, "%s.%s", menu->name, cmd);
+
+		free(cmd);
 
-		err = asprintf(&cmd, "%s.%s", menu->name, cmd);
 		if (err < 0)
 			return NULL;
+
+		cmd = tmp;
 	}
 
 	return cmd;