diff options
author | Pauli <pauli@openssl.org> | 2023-07-01 21:06:47 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-07-05 08:33:53 +1000 |
commit | 52c362b3fe5ab9b1c44ec560820b242eb3df0e3b (patch) | |
tree | d3ed758e61997ba0ad65eca6de34a69703790d12 /doc | |
parent | e4ab9d5b5cb5a6d792c313ff4d5724612351818d (diff) |
doc: update ref count doc in light of refactoring
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/21341)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/internal/man3/evp_generic_fetch.pod | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/doc/internal/man3/evp_generic_fetch.pod b/doc/internal/man3/evp_generic_fetch.pod index ce75ffbfc8..b4f625285a 100644 --- a/doc/internal/man3/evp_generic_fetch.pod +++ b/doc/internal/man3/evp_generic_fetch.pod @@ -121,6 +121,11 @@ And here's the implementation of the FOO method fetcher: if ((foo = OPENSSL_zalloc(sizeof(*foo))) == NULL) return NULL; + if (!CRYPTO_NEW_REF(&foo->refcnt, 1)) { + OPENSSL_free(foo); + return NULL; + } + foo->name_id = name_id; for (; fns->function_id != 0; fns++) { @@ -151,9 +156,16 @@ And here's the implementation of the FOO method fetcher: EVP_FOO_meth_free(EVP_FOO *foo) { + int i; + if (foo != NULL) { OSSL_PROVIDER *prov = foo->prov; + CRYPTO_DOWN_REF(&foo->refcnt, &i); + if (i > 0) + return; + + CRYPTO_FREE_REF(&foo->refcnt); OPENSSL_free(foo); ossl_provider_free(prov); } @@ -170,7 +182,7 @@ And here's the implementation of the FOO method fetcher: EVP_FOO *foo = vfoo; int ref = 0; - CRYPTO_UP_REF(&foo->refcnt, &ref, foo_lock); + CRYPTO_UP_REF(&foo->refcnt, &ref); return 1; } |