From 8d56179e5d3291d8f9e9bfd23505e3ea9159a50c Mon Sep 17 00:00:00 2001 From: tb Date: Mon, 25 Dec 2023 21:33:50 +0000 Subject: [PATCH] Rework evp_pkey_free_pkey_ptr() Rename the variable from x into pkey, make it NULL safe and unindent. ok jsing --- lib/libcrypto/evp/p_lib.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/libcrypto/evp/p_lib.c b/lib/libcrypto/evp/p_lib.c index 9fc45714ed5..b4f64906406 100644 --- a/lib/libcrypto/evp/p_lib.c +++ b/lib/libcrypto/evp/p_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_lib.c,v 1.43 2023/12/25 21:31:58 tb Exp $ */ +/* $OpenBSD: p_lib.c,v 1.44 2023/12/25 21:33:50 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -215,12 +215,13 @@ EVP_PKEY_up_ref(EVP_PKEY *pkey) } static void -evp_pkey_free_pkey_ptr(EVP_PKEY *x) +evp_pkey_free_pkey_ptr(EVP_PKEY *pkey) { - if (x->ameth && x->ameth->pkey_free) { - x->ameth->pkey_free(x); - x->pkey.ptr = NULL; - } + if (pkey == NULL || pkey->ameth == NULL || pkey->ameth->pkey_free == NULL) + return; + + pkey->ameth->pkey_free(pkey); + pkey->pkey.ptr = NULL; } /* Setup a public key ASN1 method from a NID or a string. -- 2.20.1