summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2011-09-22 12:39:24 (GMT)
committerSamuel Ortiz <sameo@linux.intel.com>2011-09-22 13:22:46 (GMT)
commit992c26026e1b4ff091ba604445915b745749c339 (patch)
treef3fafa2fb1556de6f453a3cc62d7df97933d69d8 /tools
parentf2161c20249d6d3ea5a582fe9fc03fbad57b1c88 (diff)
downloadconnman-992c26026e1b4ff091ba604445915b745749c339.zip
connman-992c26026e1b4ff091ba604445915b745749c339.tar.gz
connman-992c26026e1b4ff091ba604445915b745749c339.tar.bz2
tools: Fix memory leak in iptables-test.c
Diffstat (limited to 'tools')
-rw-r--r--tools/iptables-test.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/iptables-test.c b/tools/iptables-test.c
index e97379e..c1d4f86 100644
--- a/tools/iptables-test.c
+++ b/tools/iptables-test.c
@@ -628,7 +628,7 @@ connman_iptables_add_rule(struct connman_iptables *table,
GList *chain_tail, *chain_head;
struct ipt_entry *new_entry;
struct connman_iptables_entry *head;
- int builtin = -1;
+ int builtin = -1, ret;
chain_head = find_chain_head(table, chain_name);
if (chain_head == NULL)
@@ -659,7 +659,11 @@ connman_iptables_add_rule(struct connman_iptables *table,
head->builtin = -1;
}
- return connman_add_entry(table, new_entry, chain_tail->prev, builtin);
+ ret = connman_add_entry(table, new_entry, chain_tail->prev, builtin);
+ if (ret < 0)
+ g_free(new_entry);
+
+ return ret;
}
static struct ipt_replace *