summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-10-15 18:40:39 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-10-15 18:40:39 +0000
commit5ad8d58819b1edf318076f25a56aca24513c6b80 (patch)
treeac55017686f14546bc55ac3f5bc481b7157d5dda /sbin
parent57f035671771a0d6af02376363103ce75586bd50 (diff)
Remove some unnecessary NULL-checks before free(). Change two bzero()
calls on pf data to explicit_bzero(). ok mikeb@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/iked/config.c8
-rw-r--r--sbin/iked/iked.c5
-rw-r--r--sbin/iked/ikev2.c5
-rw-r--r--sbin/iked/ikev2_msg.c8
-rw-r--r--sbin/iked/ikev2_pld.c8
-rw-r--r--sbin/iked/pfkey.c12
6 files changed, 18 insertions, 28 deletions
diff --git a/sbin/iked/config.c b/sbin/iked/config.c
index b0d395ce5fe..1473fb17f89 100644
--- a/sbin/iked/config.c
+++ b/sbin/iked/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.37 2015/08/21 11:59:27 reyk Exp $ */
+/* $OpenBSD: config.c,v 1.38 2015/10/15 18:40:38 mmcc Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -142,8 +142,7 @@ config_free_sa(struct iked *env, struct iked_sa *sa)
ibuf_release(sa->sa_rcert.id_buf);
ibuf_release(sa->sa_eap.id_buf);
- if (sa->sa_eapid != NULL)
- free(sa->sa_eapid);
+ free(sa->sa_eapid);
ibuf_release(sa->sa_eapmsk);
free(sa);
@@ -779,8 +778,7 @@ config_setocsp(struct iked *env)
int
config_getocsp(struct iked *env, struct imsg *imsg)
{
- if (env->sc_ocsp_url)
- free(env->sc_ocsp_url);
+ free(env->sc_ocsp_url);
if (IMSG_DATA_SIZE(imsg) > 0)
env->sc_ocsp_url = get_string(imsg->data, IMSG_DATA_SIZE(imsg));
else
diff --git a/sbin/iked/iked.c b/sbin/iked/iked.c
index b74251a853f..999687fa20a 100644
--- a/sbin/iked/iked.c
+++ b/sbin/iked/iked.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iked.c,v 1.25 2015/08/21 11:59:27 reyk Exp $ */
+/* $OpenBSD: iked.c,v 1.26 2015/10/15 18:40:38 mmcc Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -383,8 +383,7 @@ parent_dispatch_ca(int fd, struct privsep_proc *p, struct imsg *imsg)
if (IMSG_DATA_SIZE(imsg) > 0)
str = get_string(imsg->data, IMSG_DATA_SIZE(imsg));
parent_reload(env, 0, str);
- if (str != NULL)
- free(str);
+ free(str);
break;
case IMSG_OCSP_FD:
ocsp_connect(env);
diff --git a/sbin/iked/ikev2.c b/sbin/iked/ikev2.c
index 9b1ee9badb5..f96fac9e7d0 100644
--- a/sbin/iked/ikev2.c
+++ b/sbin/iked/ikev2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2.c,v 1.125 2015/10/02 16:13:43 reyk Exp $ */
+/* $OpenBSD: ikev2.c,v 1.126 2015/10/15 18:40:38 mmcc Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -4148,8 +4148,7 @@ ikev2_sa_tag(struct iked_sa *sa, struct iked_id *id)
int ret = -1;
size_t len;
- if (sa->sa_tag != NULL)
- free(sa->sa_tag);
+ free(sa->sa_tag);
sa->sa_tag = NULL;
format = sa->sa_policy->pol_tag;
diff --git a/sbin/iked/ikev2_msg.c b/sbin/iked/ikev2_msg.c
index b03db56b022..fa9d678641a 100644
--- a/sbin/iked/ikev2_msg.c
+++ b/sbin/iked/ikev2_msg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2_msg.c,v 1.43 2015/08/21 11:59:27 reyk Exp $ */
+/* $OpenBSD: ikev2_msg.c,v 1.44 2015/10/15 18:40:38 mmcc Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -777,8 +777,7 @@ ikev2_msg_authverify(struct iked *env, struct iked_sa *sa,
}
done:
- if (psk != NULL)
- free(psk);
+ free(psk);
dsa_free(dsa);
return (ret);
@@ -859,8 +858,7 @@ ikev2_msg_authsign(struct iked *env, struct iked_sa *sa,
ret = 0;
done:
- if (psk != NULL)
- free(psk);
+ free(psk);
dsa_free(dsa);
return (ret);
diff --git a/sbin/iked/ikev2_pld.c b/sbin/iked/ikev2_pld.c
index dff525fc321..aa97930c130 100644
--- a/sbin/iked/ikev2_pld.c
+++ b/sbin/iked/ikev2_pld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2_pld.c,v 1.54 2015/10/01 13:57:29 sthen Exp $ */
+/* $OpenBSD: ikev2_pld.c,v 1.55 2015/10/15 18:40:38 mmcc Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -1482,10 +1482,8 @@ ikev2_pld_delete(struct iked *env, struct ikev2_payload *pld,
}
done:
- if (localspi)
- free(localspi);
- if (peersas)
- free(peersas);
+ free(localspi);
+ free(peersas);
ibuf_release(resp);
return (ret);
}
diff --git a/sbin/iked/pfkey.c b/sbin/iked/pfkey.c
index 413cdd3dbbd..b1a48b3d3ed 100644
--- a/sbin/iked/pfkey.c
+++ b/sbin/iked/pfkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkey.c,v 1.45 2015/08/26 02:09:29 jsg Exp $ */
+/* $OpenBSD: pfkey.c,v 1.46 2015/10/15 18:40:38 mmcc Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -411,10 +411,8 @@ pfkey_flow(int sd, uint8_t satype, uint8_t action, struct iked_flow *flow)
ret = pfkey_write(sd, &smsg, iov, iov_cnt, NULL, NULL);
- if (sa_srcid)
- free(sa_srcid);
- if (sa_dstid)
- free(sa_dstid);
+ free(sa_srcid);
+ free(sa_dstid);
return (ret);
}
@@ -831,7 +829,7 @@ pfkey_sa_last_used(int sd, struct iked_childsa *sa, uint64_t *last_used)
log_debug("%s: last_used %llu", __func__, *last_used);
done:
- bzero(data, n);
+ explicit_bzero(data, n);
free(data);
return (ret);
}
@@ -939,7 +937,7 @@ pfkey_sa_getspi(int sd, uint8_t satype, struct iked_childsa *sa,
log_debug("%s: spi 0x%08x", __func__, *spip);
done:
- bzero(data, n);
+ explicit_bzero(data, n);
free(data);
return (ret);
}