From d8c9e8aee4ce1268b576997166af7d9a816a2f87 Mon Sep 17 00:00:00 2001 From: jsing Date: Sun, 9 Apr 2017 14:33:21 +0000 Subject: [PATCH] Explicitly test for NULL. ok beck@ --- lib/libcrypto/buffer/buf_str.c | 8 ++++---- 1 file 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); -- 2.20.1