about summary refs log tree commit diff stats
path: root/src/tools/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/parser.c')
-rw-r--r--src/tools/parser.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/parser.c b/src/tools/parser.c
index f273923a..1ec539df 100644
--- a/src/tools/parser.c
+++ b/src/tools/parser.c
@@ -260,12 +260,13 @@ parse_args_with_freetext(const char * const inp, int min, int max)
         tokens = g_slist_append(tokens, g_strndup(token_start, token_size));
     }
 
+    free(copy);
+
     int num = g_slist_length(tokens) - 1;
 
     // if num args not valid return NULL
     if ((num < min) || (num > max)) {
         g_slist_free_full(tokens, free);
-        free(copy);
         return NULL;
 
     // if min allowed is 0 and 0 found, return empty char* array
@@ -288,7 +289,6 @@ parse_args_with_freetext(const char * const inp, int min, int max)
 
         args[arg_count] = NULL;
         g_slist_free_full(tokens, free);
-        free(copy);
 
         return args;
     }