diff --git a/command.c b/command.c index de36e732..5ecb015e 100644 --- a/command.c +++ b/command.c @@ -81,8 +81,10 @@ static struct command_t _parse_command(char *str) struct command_t cmd; char **split = g_strsplit(str, " ", 0); - cmd.command = split[0]; + cmd.command = malloc((strlen(split[0]) + 1) * sizeof(char)); + strcpy(cmd.command, split[0]); cmd.params = NULL; + g_strfreev(split); return cmd; }