From 161157a1c868746d052924bd590c5cfd9f7a75f7 Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 27 Apr 2012 01:14:17 +0100 Subject: [PATCH] Free split args in command.c --- command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; }