summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/buffer/buf_str.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2017-04-09 14:33:21 +0000
committerjsing <jsing@openbsd.org>2017-04-09 14:33:21 +0000
commitd8c9e8aee4ce1268b576997166af7d9a816a2f87 (patch)
tree784891a6b519baba460a9781d4082d782f656a50 /lib/libcrypto/buffer/buf_str.c
parentImprove unknown protocol version handling. (diff)
downloadwireguard-openbsd-d8c9e8aee4ce1268b576997166af7d9a816a2f87.tar.xz
wireguard-openbsd-d8c9e8aee4ce1268b576997166af7d9a816a2f87.zip
Explicitly test for NULL.
ok beck@
Diffstat (limited to 'lib/libcrypto/buffer/buf_str.c')
-rw-r--r--lib/libcrypto/buffer/buf_str.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libcrypto/buffer/buf_str.c b/lib/libcrypto/buffer/buf_str.c
index a9ab87a09f3..4ebc4717c83 100644
--- a/lib/libcrypto/buffer/buf_str.c
+++ b/lib/libcrypto/buffer/buf_str.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf_str.c,v 1.10 2017/01/29 17:49:22 beck Exp $ */
+/* $OpenBSD: buf_str.c,v 1.11 2017/04/09 14:33:21 jsing Exp $ */
/*
* Copyright (c) 2014 Bob Beck
*
@@ -34,7 +34,7 @@ BUF_strdup(const char *str)
char *ret = NULL;
if (str != NULL) {
- if (!(ret = strdup(str)))
+ if ((ret = strdup(str)) == NULL)
BUFerror(ERR_R_MALLOC_FAILURE);
}
return ret;
@@ -46,7 +46,7 @@ BUF_strndup(const char *str, size_t siz)
char *ret = NULL;
if (str != NULL) {
- if (!(ret = strndup(str, siz)))
+ if ((ret = strndup(str, siz)) == NULL)
BUFerror(ERR_R_MALLOC_FAILURE);
}
return ret;
@@ -58,7 +58,7 @@ BUF_memdup(const void *data, size_t siz)
void *ret = NULL;
if (data != NULL) {
- if (!(ret = malloc(siz)))
+ if ((ret = malloc(siz)) == NULL)
BUFerror(ERR_R_MALLOC_FAILURE);
else
(void) memcpy(ret, data, siz);