aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Fomenko <ext-alexey.fomenko@nokia.com>2011-03-02 04:13:21 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-03-02 04:13:21 +0100
commit1df0af76700c7f75ea43006ad6d450cdeeb6244f (patch)
tree62db1ada5ae9433213e94fd1ffbd643a4c5ff91f
parent940c7206c2a4acb386ab47199a6c313c04387f3b (diff)
downloadbusybox-w32-1df0af76700c7f75ea43006ad6d450cdeeb6244f.tar.gz
busybox-w32-1df0af76700c7f75ea43006ad6d450cdeeb6244f.tar.bz2
busybox-w32-1df0af76700c7f75ea43006ad6d450cdeeb6244f.zip
don't leak malloced variables in the loop; remove double alloc
Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/ifupdown.c7
-rw-r--r--networking/nameif.c2
2 files changed, 6 insertions, 3 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 59df4e80f..c7b560bf8 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1220,13 +1220,13 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
1220 /* ifup */ 1220 /* ifup */
1221 if (iface_state) { 1221 if (iface_state) {
1222 bb_error_msg("interface %s already configured", iface); 1222 bb_error_msg("interface %s already configured", iface);
1223 continue; 1223 goto next;
1224 } 1224 }
1225 } else { 1225 } else {
1226 /* ifdown */ 1226 /* ifdown */
1227 if (!iface_state) { 1227 if (!iface_state) {
1228 bb_error_msg("interface %s not configured", iface); 1228 bb_error_msg("interface %s not configured", iface);
1229 continue; 1229 goto next;
1230 } 1230 }
1231 } 1231 }
1232 llist_free(state_list, free); 1232 llist_free(state_list, free);
@@ -1316,6 +1316,9 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
1316 fclose(state_fp); 1316 fclose(state_fp);
1317 llist_free(state_list, free); 1317 llist_free(state_list, free);
1318 } 1318 }
1319 next:
1320 free(iface);
1321 free(liface);
1319 } 1322 }
1320 1323
1321 return any_failures; 1324 return any_failures;
diff --git a/networking/nameif.c b/networking/nameif.c
index d02c2c11b..6cf1c50c2 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -156,7 +156,7 @@ int nameif_main(int argc, char **argv)
156 156
157 if (argc) { 157 if (argc) {
158 while (*argv) { 158 while (*argv) {
159 char *ifname = xstrdup(*argv++); 159 char *ifname = *argv++;
160 prepend_new_eth_table(&clist, ifname, *argv++); 160 prepend_new_eth_table(&clist, ifname, *argv++);
161 } 161 }
162 } else { 162 } else {