diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-02-21 17:42:32 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-02-22 12:42:54 +0200 |
commit | 18fd922f6253daf6275186f6db1c1248106b35fb (patch) | |
tree | a209c735f79b0b33c42dba36d585ccf3828d2ae5 /src/iptables.c | |
parent | c529ad6f4ea829570fd6ce8cef66b974493de31a (diff) | |
download | connman-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.c | 4 |
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; } |