From 927af868c7381d3a0012436d1acb41a22d6bbb94 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 22 Sep 2013 23:11:28 +0100 Subject: [PATCH] Use stack rather than heap for autcomplete_param_with_func issue #226 --- src/tools/autocomplete.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c index 77d8c7ae..438b48b7 100644 --- a/src/tools/autocomplete.c +++ b/src/tools/autocomplete.c @@ -176,7 +176,7 @@ autocomplete_param_with_func(char *input, int *size, char *command, char *auto_msg = NULL; char inp_cpy[*size]; int i; - char *command_cpy = malloc(strlen(command) + 2); + char command_cpy[strlen(command) + 2]; sprintf(command_cpy, "%s ", command); int len = strlen(command_cpy); if ((strncmp(input, command_cpy, len) == 0) && (*size > len)) { @@ -192,7 +192,6 @@ autocomplete_param_with_func(char *input, int *size, char *command, free(found); } } - free(command_cpy); return auto_msg; }