From: tb Date: Mon, 25 Dec 2023 21:33:50 +0000 (+0000) Subject: Rework evp_pkey_free_pkey_ptr() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8d56179e5d3291d8f9e9bfd23505e3ea9159a50c;p=openbsd Rework evp_pkey_free_pkey_ptr() Rename the variable from x into pkey, make it NULL safe and unindent. ok jsing --- 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.