iptables: Fix memory leak 36/60036/2
authorNiraj Kumar Goit <niraj.g@samsung.com>
Mon, 22 Feb 2016 14:34:56 +0000 (20:04 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Wed, 9 Mar 2016 06:28:13 +0000 (22:28 -0800)
This patch free memory allocated to cbd by cb_data_new() when
get_table() return NULL.

Change-Id: Ifc40f97290c459d580f029f4cf8655d475fcd0ad
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
src/iptables.c

index 8d583ea..dd1b2e6 100755 (executable)
@@ -2364,8 +2364,10 @@ int __connman_iptables_iterate_chains(const char *table_name,
        struct connman_iptables *table;
 
        table = get_table(table_name);
-       if (!table)
+       if (!table) {
+               g_free(cbd);
                return -EINVAL;
+       }
 
        iterate_entries(table->blob_entries->entrytable,
                        table->info->valid_hooks,