diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-01-01 20:46:21 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-01-01 20:46:21 +0000 |
commit | 9b171e6d5ef9680dc42a8e1f5ba78ffa30c4b5de (patch) | |
tree | a3926271156ef35c718597c5fe53a0f0a354f1a7 /usr.sbin/dhcpd | |
parent | 70851fc3b8f8519297ae742736b560f88a290afe (diff) |
Eliminate all uses of dfree() where the pointer is either dereferenced
immediately before the use or the pointer is checked for NULL before
the call. And then there were none, so kill dfree().
Diffstat (limited to 'usr.sbin/dhcpd')
-rw-r--r-- | usr.sbin/dhcpd/alloc.c | 14 | ||||
-rw-r--r-- | usr.sbin/dhcpd/dhcp.c | 4 | ||||
-rw-r--r-- | usr.sbin/dhcpd/options.c | 7 | ||||
-rw-r--r-- | usr.sbin/dhcpd/tree.c | 8 |
4 files changed, 11 insertions, 22 deletions
diff --git a/usr.sbin/dhcpd/alloc.c b/usr.sbin/dhcpd/alloc.c index d658d0c43b5..f3306f87cb2 100644 --- a/usr.sbin/dhcpd/alloc.c +++ b/usr.sbin/dhcpd/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.10 2010/01/01 20:30:24 krw Exp $ */ +/* $OpenBSD: alloc.c,v 1.11 2010/01/01 20:46:19 krw Exp $ */ /* Memory allocation... */ @@ -54,16 +54,6 @@ dmalloc(int size, char *name) return (foo); } -void -dfree(void *ptr, char *name) -{ - if (!ptr) { - warning("dfree %s: free on null pointer.", name); - return; - } - free(ptr); -} - struct tree_cache *free_tree_caches; struct tree_cache * @@ -107,7 +97,7 @@ void free_lease_state(struct lease_state *ptr, char *name) { if (ptr->prl) - dfree(ptr->prl, name); + free(ptr->prl); ptr->next = free_lease_states; free_lease_states = ptr; } diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c index 7d0eddf419a..1bb004e2674 100644 --- a/usr.sbin/dhcpd/dhcp.c +++ b/usr.sbin/dhcpd/dhcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcp.c,v 1.28 2009/09/01 08:42:31 reyk Exp $ */ +/* $OpenBSD: dhcp.c,v 1.29 2010/01/01 20:46:19 krw Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -579,7 +579,7 @@ nak_lease(struct packet *packet, struct iaddr *cip) i = DHO_DHCP_PARAMETER_REQUEST_LIST; if (packet->options[i].data) { packet->options[i].len = 0; - dfree(packet->options[i].data, "nak_lease"); + free(packet->options[i].data); packet->options[i].data = NULL; } diff --git a/usr.sbin/dhcpd/options.c b/usr.sbin/dhcpd/options.c index 10dc064d996..4f008fb3cae 100644 --- a/usr.sbin/dhcpd/options.c +++ b/usr.sbin/dhcpd/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.24 2008/11/14 02:00:08 krw Exp $ */ +/* $OpenBSD: options.c,v 1.25 2010/01/01 20:46:20 krw Exp $ */ /* DHCP options parsing and reassembly. */ @@ -187,8 +187,7 @@ parse_option_buffer(struct packet *packet, &s[2], len); packet->options[code].len += len; t[packet->options[code].len] = 0; - dfree(packet->options[code].data, - "parse_option_buffer"); + free(packet->options[code].data); packet->options[code].data = t; } s += len + 2; @@ -518,5 +517,5 @@ do_packet(struct interface_info *interface, struct dhcp_packet *packet, /* Free the data associated with the options. */ for (i = 0; i < 256; i++) if (tp.options[i].len && tp.options[i].data) - dfree(tp.options[i].data, "do_packet"); + free(tp.options[i].data); } diff --git a/usr.sbin/dhcpd/tree.c b/usr.sbin/dhcpd/tree.c index e42e36bc3b6..8d9614bab5e 100644 --- a/usr.sbin/dhcpd/tree.c +++ b/usr.sbin/dhcpd/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.13 2010/01/01 20:30:25 krw Exp $ */ +/* $OpenBSD: tree.c,v 1.14 2010/01/01 20:46:20 krw Exp $ */ /* Routines for manipulating parse trees... */ @@ -118,8 +118,8 @@ tree_concat(struct tree *left, struct tree *right) left->data.const_val.len); memcpy(buf + left->data.const_val.len, right->data.const_val.data, right->data.const_val.len); - dfree(left->data.const_val.data, "tree_concat"); - dfree(right->data.const_val.data, "tree_concat"); + free(left->data.const_val.data); + free(right->data.const_val.data); left->data.const_val.data = buf; left->data.const_val.len += right->data.const_val.len; free(right); @@ -207,7 +207,7 @@ tree_evaluate(struct tree_cache *tree_cache) * location and size and return. */ if (tree_cache->value) - dfree(tree_cache->value, "tree_evaluate"); + free(tree_cache->value); tree_cache->value = bp; tree_cache->len = bufix; tree_cache->buf_size = bc; |