aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-03-01 16:39:45 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-03-01 16:39:45 +0000
commit5b5c0305447c61a4cc4a0c29a43c2dc2b1befe34 (patch)
treeebb8583e9e1265588592614c0b4878daded44125 /networking
parente04d15038c48aceb093d79fc8e69e5d88b670a24 (diff)
downloadbusybox-w32-5b5c0305447c61a4cc4a0c29a43c2dc2b1befe34.tar.gz
busybox-w32-5b5c0305447c61a4cc4a0c29a43c2dc2b1befe34.tar.bz2
busybox-w32-5b5c0305447c61a4cc4a0c29a43c2dc2b1befe34.zip
Cleanup patch from Denis Vlasenko. Mostly variants of removing the if(x)
from before "if(x) free(x)". git-svn-id: svn://busybox.net/trunk/busybox@14396 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'networking')
-rw-r--r--networking/ifupdown.c15
-rw-r--r--networking/inetd.c3
-rw-r--r--networking/traceroute.c6
-rw-r--r--networking/udhcp/dhcpc.c8
-rw-r--r--networking/udhcp/files.c2
5 files changed, 15 insertions, 19 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 699fa7d06..156ceb7ab 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1356,16 +1356,15 @@ extern int ifupdown_main(int argc, char **argv)
1356 } else { 1356 } else {
1357 /* Remove an interface from the linked list */ 1357 /* Remove an interface from the linked list */
1358 if (iface_state) { 1358 if (iface_state) {
1359 /* This needs to be done better */ 1359 const llist_t *link = iface_state->link;
1360 free(iface_state->data); 1360 free(iface_state->data);
1361 free(iface_state->link); 1361 iface_state->data = NULL;
1362 if (iface_state->link) { 1362 iface_state->link = NULL;
1363 iface_state->data = iface_state->link->data; 1363 if (link) {
1364 iface_state->link = iface_state->link->link; 1364 iface_state->data = link->data;
1365 } else { 1365 iface_state->link = link->link;
1366 iface_state->data = NULL;
1367 iface_state->link = NULL;
1368 } 1366 }
1367 free(link);
1369 } 1368 }
1370 } 1369 }
1371 } 1370 }
diff --git a/networking/inetd.c b/networking/inetd.c
index 9f6acdb98..931052a5a 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -413,8 +413,7 @@ static void freeconfig (servtab_t *cp)
413 free (cp->se_group); 413 free (cp->se_group);
414 free (cp->se_server); 414 free (cp->se_server);
415 for (i = 0; i < MAXARGV; i++) 415 for (i = 0; i < MAXARGV; i++)
416 if (cp->se_argv[i]) 416 free (cp->se_argv[i]);
417 free (cp->se_argv[i]);
418} 417}
419 418
420static int bump_nofile (void) 419static int bump_nofile (void)
diff --git a/networking/traceroute.c b/networking/traceroute.c
index e6011cc47..22d27f240 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -902,10 +902,8 @@ gethostinfo(const char *host)
902static void 902static void
903freehostinfo(struct hostinfo *hi) 903freehostinfo(struct hostinfo *hi)
904{ 904{
905 if (hi->name != NULL) { 905 free(hi->name);
906 free(hi->name); 906 hi->name = NULL;
907 hi->name = NULL;
908 }
909 free((char *)hi->addrs); 907 free((char *)hi->addrs);
910 free((char *)hi); 908 free((char *)hi);
911} 909}
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index e035bd4c2..7e7f94a5a 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -217,7 +217,7 @@ int main(int argc, char *argv[])
217 case 'c': 217 case 'c':
218 if (no_clientid) show_usage(); 218 if (no_clientid) show_usage();
219 len = strlen(optarg) > 255 ? 255 : strlen(optarg); 219 len = strlen(optarg) > 255 ? 255 : strlen(optarg);
220 if (client_config.clientid) free(client_config.clientid); 220 free(client_config.clientid);
221 client_config.clientid = xmalloc(len + 2); 221 client_config.clientid = xmalloc(len + 2);
222 client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID; 222 client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID;
223 client_config.clientid[OPT_LEN] = len; 223 client_config.clientid[OPT_LEN] = len;
@@ -230,7 +230,7 @@ int main(int argc, char *argv[])
230 break; 230 break;
231 case 'V': 231 case 'V':
232 len = strlen(optarg) > 255 ? 255 : strlen(optarg); 232 len = strlen(optarg) > 255 ? 255 : strlen(optarg);
233 if (client_config.vendorclass) free(client_config.vendorclass); 233 free(client_config.vendorclass);
234 client_config.vendorclass = xmalloc(len + 2); 234 client_config.vendorclass = xmalloc(len + 2);
235 client_config.vendorclass[OPT_CODE] = DHCP_VENDOR; 235 client_config.vendorclass[OPT_CODE] = DHCP_VENDOR;
236 client_config.vendorclass[OPT_LEN] = len; 236 client_config.vendorclass[OPT_LEN] = len;
@@ -245,7 +245,7 @@ int main(int argc, char *argv[])
245 case 'h': 245 case 'h':
246 case 'H': 246 case 'H':
247 len = strlen(optarg) > 255 ? 255 : strlen(optarg); 247 len = strlen(optarg) > 255 ? 255 : strlen(optarg);
248 if (client_config.hostname) free(client_config.hostname); 248 free(client_config.hostname);
249 client_config.hostname = xmalloc(len + 2); 249 client_config.hostname = xmalloc(len + 2);
250 client_config.hostname[OPT_CODE] = DHCP_HOST_NAME; 250 client_config.hostname[OPT_CODE] = DHCP_HOST_NAME;
251 client_config.hostname[OPT_LEN] = len; 251 client_config.hostname[OPT_LEN] = len;
@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
253 break; 253 break;
254 case 'F': 254 case 'F':
255 len = strlen(optarg) > 255 ? 255 : strlen(optarg); 255 len = strlen(optarg) > 255 ? 255 : strlen(optarg);
256 if (client_config.fqdn) free(client_config.fqdn); 256 free(client_config.fqdn);
257 client_config.fqdn = xmalloc(len + 5); 257 client_config.fqdn = xmalloc(len + 5);
258 client_config.fqdn[OPT_CODE] = DHCP_FQDN; 258 client_config.fqdn[OPT_CODE] = DHCP_FQDN;
259 client_config.fqdn[OPT_LEN] = len + 3; 259 client_config.fqdn[OPT_LEN] = len + 3;
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 01534f2bb..416b1feb0 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -62,7 +62,7 @@ static int read_str(const char *line, void *arg)
62{ 62{
63 char **dest = arg; 63 char **dest = arg;
64 64
65 if (*dest) free(*dest); 65 free(*dest);
66 *dest = strdup(line); 66 *dest = strdup(line);
67 67
68 return 1; 68 return 1;