diff options
author | James Booth <boothj5@gmail.com> | 2013-09-22 23:11:28 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-09-23 00:05:50 +0100 |
commit | 927af868c7381d3a0012436d1acb41a22d6bbb94 (patch) | |
tree | 53260585da044b0388f0c8d1556933e8d1912c4e /src | |
parent | 426b669c35eddb96964e4c45eaa75944d63cb75a (diff) | |
download | profani-tty-927af868c7381d3a0012436d1acb41a22d6bbb94.tar.gz |
Use stack rather than heap for autcomplete_param_with_func
issue #226
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/autocomplete.c | 3 |
1 files changed, 1 insertions, 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; } |