summaryrefslogtreecommitdiff
path: root/src/iptables.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2013-02-21 17:42:32 +0100
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-02-22 12:42:54 +0200
commit18fd922f6253daf6275186f6db1c1248106b35fb (patch)
treea209c735f79b0b33c42dba36d585ccf3828d2ae5 /src/iptables.c
parentc529ad6f4ea829570fd6ce8cef66b974493de31a (diff)
downloadconnman-18fd922f6253daf6275186f6db1c1248106b35fb.tar.gz
connman-18fd922f6253daf6275186f6db1c1248106b35fb.tar.bz2
connman-18fd922f6253daf6275186f6db1c1248106b35fb.zip
iptables: Free table pointer
And also use g_strv_length() to count the number of entries. Thanks Tomasz!
Diffstat (limited to 'src/iptables.c')
-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;
}