summaryrefslogtreecommitdiffstats
path: root/lib/libssl/d1_both.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-05-28 13:03:24 +0000
committerjsing <jsing@openbsd.org>2014-05-28 13:03:24 +0000
commit9d9224c34fa672afefd4702ccd40f7a3f0d33859 (patch)
treeceb592a1008435edad633dfdf1070ac72db0a1ed /lib/libssl/d1_both.c
parentMore KNF. (diff)
downloadwireguard-openbsd-9d9224c34fa672afefd4702ccd40f7a3f0d33859.tar.xz
wireguard-openbsd-9d9224c34fa672afefd4702ccd40f7a3f0d33859.zip
There is no point in checking if a pointer is non-NULL before calling free,
since free already does this for us. Also remove some pointless NULL assignments, where the result from malloc(3) is immediately assigned to the same variable. ok miod@
Diffstat (limited to 'lib/libssl/d1_both.c')
-rw-r--r--lib/libssl/d1_both.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/libssl/d1_both.c b/lib/libssl/d1_both.c
index 0e328256959..59987bc1d8a 100644
--- a/lib/libssl/d1_both.c
+++ b/lib/libssl/d1_both.c
@@ -200,8 +200,7 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly)
if (reassembly) {
bitmask = malloc(RSMBLY_BITMASK_SIZE(frag_len));
if (bitmask == NULL) {
- if (buf != NULL)
- free(buf);
+ free(buf);
free(frag);
return NULL;
}
@@ -223,10 +222,8 @@ dtls1_hm_fragment_free(hm_fragment *frag)
EVP_MD_CTX_destroy(
frag->msg_header.saved_retransmit_state.write_hash);
}
- if (frag->fragment)
- free(frag->fragment);
- if (frag->reassembly)
- free(frag->reassembly);
+ free(frag->fragment);
+ free(frag->reassembly);
free(frag);
}