summaryrefslogtreecommitdiff
path: root/networking/ifupdown.c
diff options
context:
space:
mode:
authorRob Landley2006-03-01 16:39:45 +0000
committerRob Landley2006-03-01 16:39:45 +0000
commite7c43b66d74ee9902a6732122788a7a16bcfbf18 (patch)
treeebb8583e9e1265588592614c0b4878daded44125 /networking/ifupdown.c
parent93f2286e6e59dab5eed14b5912a79254031c5a62 (diff)
downloadbusybox-e7c43b66d74ee9902a6732122788a7a16bcfbf18.zip
busybox-e7c43b66d74ee9902a6732122788a7a16bcfbf18.tar.gz
Cleanup patch from Denis Vlasenko. Mostly variants of removing the if(x)
from before "if(x) free(x)".
Diffstat (limited to 'networking/ifupdown.c')
-rw-r--r--networking/ifupdown.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 699fa7d..156ceb7 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1356,16 +1356,15 @@ extern int ifupdown_main(int argc, char **argv)
} else {
/* Remove an interface from the linked list */
if (iface_state) {
- /* This needs to be done better */
+ const llist_t *link = iface_state->link;
free(iface_state->data);
- free(iface_state->link);
- if (iface_state->link) {
- iface_state->data = iface_state->link->data;
- iface_state->link = iface_state->link->link;
- } else {
- iface_state->data = NULL;
- iface_state->link = NULL;
+ iface_state->data = NULL;
+ iface_state->link = NULL;
+ if (link) {
+ iface_state->data = link->data;
+ iface_state->link = link->link;
}
+ free(link);
}
}
}