about summary refs log tree commit diff stats
path: root/src/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parser.c b/src/parser.c
index ea26725c..4b0fcede 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -92,13 +92,15 @@ parse_args(const char * const inp, int min, int max)
     // if num args not valid return NULL
     if ((num < min) || (num > max)) {
         g_slist_free_full(tokens, free);
-        free(copy);
+        g_free(copy);
         return NULL;
 
     // if min allowed is 0 and 0 found, return empty char* array
     } else if (min == 0 && num == 0) {
+        g_slist_free_full(tokens, free);
         gchar **args = malloc((num + 1) * sizeof(*args));
         args[0] = NULL;
+        g_free(copy);
         return args;
 
     // otherwise return args array
@@ -115,7 +117,7 @@ parse_args(const char * const inp, int min, int max)
 
         args[arg_count] = NULL;
         g_slist_free_full(tokens, free);
-        free(copy);
+        g_free(copy);
 
         return args;
     }