summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-12-25 21:33:50 +0000
committertb <>2023-12-25 21:33:50 +0000
commit63761f53109506984f2b76eef545f9d8596cd445 (patch)
tree25628447dd6b8b89f6081cba5e619cf50d1a38ae /src/lib
parentd03ae436a18aad2333592e70d9d5f629886f8a22 (diff)
downloadopenbsd-63761f53109506984f2b76eef545f9d8596cd445.tar.gz
openbsd-63761f53109506984f2b76eef545f9d8596cd445.tar.bz2
openbsd-63761f53109506984f2b76eef545f9d8596cd445.zip
Rework evp_pkey_free_pkey_ptr()
Rename the variable from x into pkey, make it NULL safe and unindent. ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/evp/p_lib.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 9fc45714ed..b4f6490640 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_lib.c,v 1.43 2023/12/25 21:31:58 tb Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.44 2023/12/25 21:33:50 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -215,12 +215,13 @@ EVP_PKEY_up_ref(EVP_PKEY *pkey)
215} 215}
216 216
217static void 217static void
218evp_pkey_free_pkey_ptr(EVP_PKEY *x) 218evp_pkey_free_pkey_ptr(EVP_PKEY *pkey)
219{ 219{
220 if (x->ameth && x->ameth->pkey_free) { 220 if (pkey == NULL || pkey->ameth == NULL || pkey->ameth->pkey_free == NULL)
221 x->ameth->pkey_free(x); 221 return;
222 x->pkey.ptr = NULL; 222
223 } 223 pkey->ameth->pkey_free(pkey);
224 pkey->pkey.ptr = NULL;
224} 225}
225 226
226/* Setup a public key ASN1 method from a NID or a string. 227/* Setup a public key ASN1 method from a NID or a string.