about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-09-22 23:11:28 +0100
committerJames Booth <boothj5@gmail.com>2013-09-23 00:05:50 +0100
commit927af868c7381d3a0012436d1acb41a22d6bbb94 (patch)
tree53260585da044b0388f0c8d1556933e8d1912c4e
parent426b669c35eddb96964e4c45eaa75944d63cb75a (diff)
downloadprofani-tty-927af868c7381d3a0012436d1acb41a22d6bbb94.tar.gz
Use stack rather than heap for autcomplete_param_with_func
issue #226
-rw-r--r--src/tools/autocomplete.c3
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;
 }