about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-04-27 01:14:17 +0100
committerJames Booth <boothj5@gmail.com>2012-04-27 01:14:17 +0100
commit161157a1c868746d052924bd590c5cfd9f7a75f7 (patch)
tree09d9f168fe932195dc6da089cf648758b49b238e
parent0c0a242972456e19a609b70cbbfc774cbfc1a91f (diff)
downloadprofani-tty-161157a1c868746d052924bd590c5cfd9f7a75f7.tar.gz
Free split args in command.c
-rw-r--r--command.c4
1 files changed, 3 insertions, 1 deletions
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;
 }