diff options
author | 2015-12-05 06:42:18 +0000 | |
---|---|---|
committer | 2015-12-05 06:42:18 +0000 | |
commit | c8077e090a80f5a382b858a03c121428e45868ab (patch) | |
tree | c5efa23523fc210227ec7f370c2d442177be7e19 | |
parent | strings.h -> string.h as necessary to prevent implicit declaration (diff) | |
download | wireguard-openbsd-c8077e090a80f5a382b858a03c121428e45868ab.tar.xz wireguard-openbsd-c8077e090a80f5a382b858a03c121428e45868ab.zip |
strings.h -> string.h to prevent an implicit declaration warning. Also
remove a handful of NULL-checks before free().
-rw-r--r-- | usr.sbin/snmpd/agentx.c | 5 | ||||
-rw-r--r-- | usr.sbin/snmpd/ber.c | 7 | ||||
-rw-r--r-- | usr.sbin/snmpd/control.c | 8 | ||||
-rw-r--r-- | usr.sbin/snmpd/mps.c | 8 | ||||
-rw-r--r-- | usr.sbin/snmpd/smi.c | 6 | ||||
-rw-r--r-- | usr.sbin/snmpd/trap.c | 5 |
6 files changed, 15 insertions, 24 deletions
diff --git a/usr.sbin/snmpd/agentx.c b/usr.sbin/snmpd/agentx.c index 684506b89b4..6ae159b2268 100644 --- a/usr.sbin/snmpd/agentx.c +++ b/usr.sbin/snmpd/agentx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agentx.c,v 1.9 2015/07/19 01:08:07 blambert Exp $ */ +/* $OpenBSD: agentx.c,v 1.10 2015/12/05 06:42:18 mmcc Exp $ */ /* * Copyright (c) 2013,2014 Bret Stephen Lambert <blambert@openbsd.org> * @@ -259,8 +259,7 @@ void snmp_agentx_pdu_free(struct agentx_pdu *pdu) { free(pdu->buffer); - if (pdu->request) - free(pdu->request); + free(pdu->request); free(pdu); } diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c index 33fb431d783..7c3a48ecd69 100644 --- a/usr.sbin/snmpd/ber.c +++ b/usr.sbin/snmpd/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.29 2015/02/12 00:30:38 pelikan Exp $ */ +/* $OpenBSD: ber.c,v 1.30 2015/12/05 06:42:18 mmcc Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org> @@ -25,7 +25,7 @@ #include <stdlib.h> #include <err.h> /* XXX for debug output */ #include <stdio.h> /* XXX for debug output */ -#include <strings.h> +#include <string.h> #include <unistd.h> #include <stdarg.h> @@ -1256,8 +1256,7 @@ ber_set_writecallback(struct ber_element *elm, void (*cb)(void *, size_t), void ber_free(struct ber *b) { - if (b->br_wbuf != NULL) - free (b->br_wbuf); + free(b->br_wbuf); } static ssize_t diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c index b705c248fc0..79ad97e0f38 100644 --- a/usr.sbin/snmpd/control.c +++ b/usr.sbin/snmpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.35 2015/11/23 19:31:52 reyk Exp $ */ +/* $OpenBSD: control.c,v 1.36 2015/12/05 06:42:18 mmcc Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -626,8 +626,7 @@ control_dispatch_agentx(int fd, short event, void *arg) uptime = smi_getticks(); if ((pdu = snmp_agentx_response_pdu(uptime, error, idx)) == NULL) { log_debug("failed to generate response"); - if (varcpy) - free(varcpy); + free(varcpy); control_event_add(c, fd, EV_WRITE, NULL); /* XXX -- EV_WRITE? */ return; } @@ -652,8 +651,7 @@ control_dispatch_agentx(int fd, short event, void *arg) log_debug("subagent session '%i' destroyed", h->sessionid); snmp_agentx_free(h); purge_registered_oids(&c->oids); - if (varcpy) - free(varcpy); + free(varcpy); control_close(c, "agentx teardown", NULL); } diff --git a/usr.sbin/snmpd/mps.c b/usr.sbin/snmpd/mps.c index 506c1d0cb82..c345cb59e62 100644 --- a/usr.sbin/snmpd/mps.c +++ b/usr.sbin/snmpd/mps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mps.c,v 1.22 2015/10/08 08:17:30 sthen Exp $ */ +/* $OpenBSD: mps.c,v 1.23 2015/12/05 06:42:18 mmcc Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org> @@ -79,8 +79,7 @@ mps_setstr(struct oid *oid, struct ber_oid *o, struct ber_element **elm) return (-1); if ((v = (void *)strdup(s)) == NULL) return (-1); - if (oid->o_data != NULL) - free(oid->o_data); + free(oid->o_data); oid->o_data = v; oid->o_val = strlen(v); @@ -353,8 +352,7 @@ mps_set(struct ber_oid *o, void *p, long long len) value = smi_find(&key); if (value == NULL) return (-1); - if (value->o_data != NULL) - free(value->o_data); + free(value->o_data); value->o_data = p; value->o_val = len; diff --git a/usr.sbin/snmpd/smi.c b/usr.sbin/snmpd/smi.c index 0f1bd13c13d..0777cc0e41d 100644 --- a/usr.sbin/snmpd/smi.c +++ b/usr.sbin/snmpd/smi.c @@ -175,8 +175,7 @@ smi_delete(struct oid *oid) value == oid) RB_REMOVE(oidtree, &smi_oidtree, value); - if (oid->o_data != NULL) - free(oid->o_data); + free(oid->o_data); if (oid->o_flags & OID_DYNAMIC) { free(oid->o_name); free(oid); @@ -536,8 +535,7 @@ smi_print_element(struct ber_element *root) return (str); fail: - if (str != NULL) - free(str); + free(str); return (NULL); } diff --git a/usr.sbin/snmpd/trap.c b/usr.sbin/snmpd/trap.c index d8784bd1ff0..126bf27f5f5 100644 --- a/usr.sbin/snmpd/trap.c +++ b/usr.sbin/snmpd/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.25 2015/11/21 13:09:47 reyk Exp $ */ +/* $OpenBSD: trap.c,v 1.26 2015/12/05 06:42:18 mmcc Exp $ */ /* * Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org> @@ -138,8 +138,7 @@ trap_agentx(struct agentx_handle *h, struct agentx_pdu *pdu, int *idx, done: if (varbind != NULL) ber_free_elements(varbind); - if (v) - free(v); + free(v); *idx = x; return (ret); } |