diff options
author | Nishant Chaprana <n.chaprana@samsung.com> | 2016-03-15 18:26:46 +0530 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2016-03-22 11:25:52 +0200 |
commit | f4b58a0816f708fa01fa15afdb386c89b5f07d8b (patch) | |
tree | f7d9e069b8ffb5c81a2b2f8ae46d71c6f8ab16cf | |
parent | b0d56ee9f192642187d8b9f1142a4ff4fc11f49c (diff) | |
download | connman-f4b58a0816f708fa01fa15afdb386c89b5f07d8b.tar.gz |
iptables-unit: Fixed dereferencing NULL pointer in assert_rule()
-rw-r--r-- | tools/iptables-unit.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/iptables-unit.c b/tools/iptables-unit.c index 9c09867e..301ce6ec 100644 --- a/tools/iptables-unit.c +++ b/tools/iptables-unit.c @@ -33,6 +33,7 @@ static bool assert_rule(const char *table_name, const char *rule) char *cmd, *output, **lines; GError **error = NULL; int i; + bool ret = true; cmd = g_strdup_printf(IPTABLES_SAVE " -t %s", table_name); g_spawn_command_line_sync(cmd, &output, NULL, NULL, error); @@ -46,12 +47,12 @@ static bool assert_rule(const char *table_name, const char *rule) if (g_strcmp0(lines[i], rule) == 0) break; } - g_strfreev(lines); if (!lines[i]) - return false; + ret = false; - return true; + g_strfreev(lines); + return ret; } static void assert_rule_exists(const char *table_name, const char *rule) |