From e1719702fba91273e3364dc176b87c487aeed686 Mon Sep 17 00:00:00 2001 From: tb Date: Sat, 19 Nov 2022 04:36:52 +0000 Subject: [PATCH] Unindent and check some pointers explicitly against NULL --- lib/libcrypto/hmac/hm_ameth.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/libcrypto/hmac/hm_ameth.c b/lib/libcrypto/hmac/hm_ameth.c index dfd7169ba0d..5b52af658cd 100644 --- a/lib/libcrypto/hmac/hm_ameth.c +++ b/lib/libcrypto/hmac/hm_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hm_ameth.c,v 1.17 2022/11/19 04:32:49 tb Exp $ */ +/* $OpenBSD: hm_ameth.c,v 1.18 2022/11/19 04:36:52 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2007. */ @@ -84,13 +84,15 @@ hmac_size(const EVP_PKEY *pkey) static void hmac_key_free(EVP_PKEY *pkey) { - ASN1_OCTET_STRING *os = pkey->pkey.ptr; + ASN1_OCTET_STRING *os; - if (os) { - if (os->data) - explicit_bzero(os->data, os->length); - ASN1_OCTET_STRING_free(os); - } + if ((os = pkey->pkey.ptr) == NULL) + return; + + if (os->data != NULL) + explicit_bzero(os->data, os->length); + + ASN1_OCTET_STRING_free(os); } static int -- 2.20.1