don't leak malloced variables in the loop; remove double alloc
authorAlexey Fomenko <ext-alexey.fomenko@nokia.com>
Wed, 2 Mar 2011 03:13:21 +0000 (04:13 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 2 Mar 2011 03:13:21 +0000 (04:13 +0100)
Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/ifupdown.c
networking/nameif.c

index 59df4e80fa396ce1e50114c2ea30ff72086da129..c7b560bf82ee1db98577f67c83ddbd0e1d78705d 100644 (file)
@@ -1220,13 +1220,13 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
                                /* ifup */
                                if (iface_state) {
                                        bb_error_msg("interface %s already configured", iface);
-                                       continue;
+                                       goto next;
                                }
                        } else {
                                /* ifdown */
                                if (!iface_state) {
                                        bb_error_msg("interface %s not configured", iface);
-                                       continue;
+                                       goto next;
                                }
                        }
                        llist_free(state_list, free);
@@ -1316,6 +1316,9 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
                        fclose(state_fp);
                        llist_free(state_list, free);
                }
+ next:
+               free(iface);
+               free(liface);
        }
 
        return any_failures;
index d02c2c11bfc4fbcca6975953b9e042865ac19aad..6cf1c50c2e26310c0549e696cd03fb21153779ca 100644 (file)
@@ -156,7 +156,7 @@ int nameif_main(int argc, char **argv)
 
        if (argc) {
                while (*argv) {
-                       char *ifname = xstrdup(*argv++);
+                       char *ifname = *argv++;
                        prepend_new_eth_table(&clist, ifname, *argv++);
                }
        } else {