From 0212ee709462b3ddc8d36dea8c8c1dfe034a39b0 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 19 Nov 2022 04:36:52 +0000 Subject: Unindent and check some pointers explicitly against NULL --- src/lib/libcrypto/hmac/hm_ameth.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/hmac/hm_ameth.c b/src/lib/libcrypto/hmac/hm_ameth.c index dfd7169ba0..5b52af658c 100644 --- a/src/lib/libcrypto/hmac/hm_ameth.c +++ b/src/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 -- cgit v1.2.3-55-g6feb