1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Use stack rather than heap for autcomplete_param_with_func

issue #226
This commit is contained in:
James Booth 2013-09-22 23:11:28 +01:00
parent 426b669c35
commit 927af868c7

View File

@ -176,7 +176,7 @@ autocomplete_param_with_func(char *input, int *size, char *command,
char *auto_msg = NULL; char *auto_msg = NULL;
char inp_cpy[*size]; char inp_cpy[*size];
int i; int i;
char *command_cpy = malloc(strlen(command) + 2); char command_cpy[strlen(command) + 2];
sprintf(command_cpy, "%s ", command); sprintf(command_cpy, "%s ", command);
int len = strlen(command_cpy); int len = strlen(command_cpy);
if ((strncmp(input, command_cpy, len) == 0) && (*size > len)) { 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(found);
} }
} }
free(command_cpy);
return auto_msg; return auto_msg;
} }