diff options
author | Flávio Ceolin <flavio.ceolin@profusion.mobi> | 2011-12-29 15:48:40 -0200 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-01-05 11:06:34 +0100 |
commit | 0e24f4771d29aa6e70d13f3d815072f9aa85ccf8 (patch) | |
tree | 056cb34a344b43f6c41d87f1db1c560f55cca48d /src/iptables.c | |
parent | de96413b24937db8993a4eaee6ee03db9b9047e0 (diff) | |
download | connman-0e24f4771d29aa6e70d13f3d815072f9aa85ccf8.tar.gz connman-0e24f4771d29aa6e70d13f3d815072f9aa85ccf8.tar.bz2 connman-0e24f4771d29aa6e70d13f3d815072f9aa85ccf8.zip |
iptables: Small improvements on ipatables_init()
Just returning NULL instead of go to "err:" when
"table" is NULL, also removing a duplicated
g_free(module).
It's avoiding, at least, a "goto" + "g_free()" +
"table_cleanup()".
Diffstat (limited to 'src/iptables.c')
-rw-r--r-- | src/iptables.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/iptables.c b/src/iptables.c index 9d6a9e70..807f22c2 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -1176,17 +1176,18 @@ static struct connman_iptables *iptables_init(char *table_name) DBG("%s", table_name); if (xtables_insmod("ip_tables", NULL, TRUE) != 0) - goto err; + return NULL; module = g_strconcat("iptable_", table_name, NULL); if (module == NULL) - goto err; + return NULL; - if (xtables_insmod(module, NULL, TRUE) != 0) - goto err; + if (xtables_insmod(module, NULL, TRUE) != 0) { + g_free(module); + return NULL; + } g_free(module); - module = NULL; table = g_hash_table_lookup(table_hash, table_name); if (table != NULL) @@ -1239,8 +1240,6 @@ static struct connman_iptables *iptables_init(char *table_name) return table; err: - g_free(module); - table_cleanup(table); return NULL; |