iptables: Fix uninitialised use of entry_return
authorKalle Valo <kalle.valo@canonical.com>
Mon, 7 Feb 2011 13:33:56 +0000 (15:33 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 8 Feb 2011 11:58:54 +0000 (12:58 +0100)
src/iptables.c:432:20: error: ‘entry_return’ may be used
uninitialized in this function

src/iptables.c

index 9e7f717..8f8ab53 100644 (file)
@@ -450,7 +450,7 @@ static int iptables_add_chain(struct connman_iptables *table,
                                sizeof(struct error_target);
        entry_head = g_try_malloc0(entry_head_size);
        if (entry_head == NULL)
-               goto err;
+               goto err_head;
 
        memset(entry_head, 0, entry_head_size);
 
@@ -463,7 +463,7 @@ static int iptables_add_chain(struct connman_iptables *table,
        strcpy(error->error, name);
 
        if (iptables_add_entry(table, entry_head, last, -1) < 0)
-               goto err;
+               goto err_head;
 
        /* tail entry */
        entry_return_size = sizeof(struct ipt_entry) +
@@ -488,8 +488,9 @@ static int iptables_add_chain(struct connman_iptables *table,
        return 0;
 
 err:
-       g_free(entry_head);
        g_free(entry_return);
+err_head:
+       g_free(entry_head);
 
        return -ENOMEM;
 }