summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/iptables.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/iptables.c b/src/iptables.c
index 9685432d..0662f02a 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -1687,7 +1687,7 @@ static int prepare_getopt_args(const char *str, struct parse_context *ctx)
tokens = g_strsplit_set(str, " ", -1);
- for (i = 0; tokens[i]; i++);
+ i = g_strv_length(tokens);
/* Add space for the argv[0] value */
ctx->argc = i + 1;
@@ -1707,6 +1707,8 @@ static int prepare_getopt_args(const char *str, struct parse_context *ctx)
for (i = 1; i < ctx->argc; i++)
ctx->argv[i] = tokens[i - 1];
+ g_free(tokens);
+
return 0;
}