diff options
author | 2015-12-21 21:39:11 +0000 | |
---|---|---|
committer | 2015-12-21 21:39:11 +0000 | |
commit | 0582c210249bf7aeceeeb978c558242b6c94c4dc (patch) | |
tree | 534808225cc15a58aa6d90fe319bed78cafd1abe /usr.sbin | |
parent | remove NULL-check before free() (diff) | |
download | wireguard-openbsd-0582c210249bf7aeceeeb978c558242b6c94c4dc.tar.xz wireguard-openbsd-0582c210249bf7aeceeeb978c558242b6c94c4dc.zip |
remove NULL-checks before free()
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dhcpd/alloc.c | 5 | ||||
-rw-r--r-- | usr.sbin/dhcpd/dhcp.c | 5 | ||||
-rw-r--r-- | usr.sbin/dhcpd/tree.c | 5 |
3 files changed, 6 insertions, 9 deletions
diff --git a/usr.sbin/dhcpd/alloc.c b/usr.sbin/dhcpd/alloc.c index 6b8f0069738..f42af8211d3 100644 --- a/usr.sbin/dhcpd/alloc.c +++ b/usr.sbin/dhcpd/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.12 2010/01/02 04:21:16 krw Exp $ */ +/* $OpenBSD: alloc.c,v 1.13 2015/12/21 21:39:11 mmcc Exp $ */ /* Memory allocation... */ @@ -88,8 +88,7 @@ new_lease_state(char *name) void free_lease_state(struct lease_state *ptr, char *name) { - if (ptr->prl) - free(ptr->prl); + 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 f90aa4a3983..6ce9af56a0b 100644 --- a/usr.sbin/dhcpd/dhcp.c +++ b/usr.sbin/dhcpd/dhcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcp.c,v 1.43 2015/08/20 22:39:29 deraadt Exp $ */ +/* $OpenBSD: dhcp.c,v 1.44 2015/12/21 21:39:11 mmcc Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -743,8 +743,7 @@ ack_lease(struct packet *packet, struct lease *lease, unsigned int offer, !memcmp(lease->client_hostname, packet->options[DHO_HOST_NAME].data, packet->options[DHO_HOST_NAME].len)) { } else if (packet->options[DHO_HOST_NAME].len) { - if (lease->client_hostname) - free(lease->client_hostname); + free(lease->client_hostname); lease->client_hostname = malloc( packet->options[DHO_HOST_NAME].len + 1); if (!lease->client_hostname) diff --git a/usr.sbin/dhcpd/tree.c b/usr.sbin/dhcpd/tree.c index 02526992bb5..7e223d20a3b 100644 --- a/usr.sbin/dhcpd/tree.c +++ b/usr.sbin/dhcpd/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.15 2010/01/02 04:21:16 krw Exp $ */ +/* $OpenBSD: tree.c,v 1.16 2015/12/21 21:39:11 mmcc Exp $ */ /* Routines for manipulating parse trees... */ @@ -213,8 +213,7 @@ tree_evaluate(struct tree_cache *tree_cache) * Free the old buffer if needed, then store the new buffer * location and size and return. */ - if (tree_cache->value) - free(tree_cache->value); + free(tree_cache->value); tree_cache->value = bp; tree_cache->len = bufix; tree_cache->buf_size = bc; |