]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
docs: document that *_free(NULL) does nothing
authorVita Batrla <vitezslav.batrla@oracle.com>
Tue, 25 Jun 2024 09:58:49 +0000 (11:58 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 27 Jun 2024 16:34:13 +0000 (18:34 +0200)
Explicitly documents that *_free(NULL) does nothing.
Fixes two cases where that wasn't true.
Fixes #24675.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Sasa Nedvedicky <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24735)

(cherry picked from commit 981d129a5609ee2e031367c34c67a9f61a5bfd66)

60 files changed:
crypto/context.c
doc/man3/ASN1_INTEGER_new.pod
doc/man3/ASYNC_WAIT_CTX_new.pod
doc/man3/BIO_ADDR.pod
doc/man3/BIO_ADDRINFO.pod
doc/man3/BIO_meth_new.pod
doc/man3/BN_generate_prime.pod
doc/man3/BUF_MEM_new.pod
doc/man3/CRYPTO_THREAD_run_once.pod
doc/man3/CTLOG_STORE_new.pod
doc/man3/CTLOG_new.pod
doc/man3/CT_POLICY_EVAL_CTX_new.pod
doc/man3/DH_meth_new.pod
doc/man3/DSA_SIG_new.pod
doc/man3/DSA_meth_new.pod
doc/man3/ECDSA_SIG_new.pod
doc/man3/ENGINE_add.pod
doc/man3/EVP_ASYM_CIPHER_free.pod
doc/man3/EVP_CIPHER_meth_new.pod
doc/man3/EVP_DigestInit.pod
doc/man3/EVP_EncodeInit.pod
doc/man3/EVP_EncryptInit.pod
doc/man3/EVP_KEM_free.pod
doc/man3/EVP_KEYEXCH_free.pod
doc/man3/EVP_KEYMGMT.pod
doc/man3/EVP_MD_meth_new.pod
doc/man3/EVP_PKEY_ASN1_METHOD.pod
doc/man3/EVP_PKEY_meth_new.pod
doc/man3/EVP_SIGNATURE.pod
doc/man3/HMAC.pod
doc/man3/NCONF_new_ex.pod
doc/man3/OCSP_REQUEST_new.pod
doc/man3/OCSP_cert_to_id.pod
doc/man3/OCSP_response_status.pod
doc/man3/OPENSSL_LH_COMPFUNC.pod
doc/man3/OPENSSL_init_crypto.pod
doc/man3/OPENSSL_malloc.pod
doc/man3/OPENSSL_secure_malloc.pod
doc/man3/OSSL_CMP_CTX_new.pod
doc/man3/OSSL_CMP_SRV_CTX_new.pod
doc/man3/OSSL_DECODER.pod
doc/man3/OSSL_DECODER_CTX.pod
doc/man3/OSSL_ENCODER.pod
doc/man3/OSSL_ENCODER_CTX.pod
doc/man3/OSSL_HTTP_REQ_CTX.pod
doc/man3/OSSL_LIB_CTX.pod
doc/man3/OSSL_PARAM_BLD.pod
doc/man3/OSSL_PARAM_dup.pod
doc/man3/OSSL_SELF_TEST_new.pod
doc/man3/OSSL_STORE_INFO.pod
doc/man3/OSSL_STORE_LOADER.pod
doc/man3/OSSL_STORE_SEARCH.pod
doc/man3/RSA_meth_new.pod
doc/man3/SCT_new.pod
doc/man3/TS_RESP_CTX_new.pod
doc/man3/X509_LOOKUP.pod
doc/man3/X509_LOOKUP_meth_new.pod
doc/man3/X509_STORE_new.pod
doc/man3/X509_dup.pod
doc/man3/X509_new.pod

index 548665fba265f47f49aa8ea608b6985c5ce90eae..ac6938e619eb1d93a9b6885c28477f7e45d0e32c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -240,7 +240,7 @@ int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file)
 
 void OSSL_LIB_CTX_free(OSSL_LIB_CTX *ctx)
 {
-    if (ossl_lib_ctx_is_default(ctx))
+    if (ctx == NULL || ossl_lib_ctx_is_default(ctx))
         return;
 
 #ifndef FIPS_MODULE
index 4722f880c0b28dedba43505c5ec1ed04d52495e1..fb9f3255d8186e23395933db3de7e834a169cfb1 100644 (file)
@@ -18,6 +18,7 @@ ASN1_INTEGER_new, ASN1_INTEGER_free - ASN1_INTEGER allocation functions
 ASN1_INTEGER_new() returns an allocated B<ASN1_INTEGER> structure.
 
 ASN1_INTEGER_free() frees up a single B<ASN1_INTEGER> object.
+If the argument is NULL, nothing is done.
 
 B<ASN1_INTEGER> structure representing the ASN.1 INTEGER type
 
index 7621a8b3a166b11b6d84bfb7ab76f43deadbf2ec..5293c0af5ed20f21defc5cf6a1ef1d67dd84f1e6 100644 (file)
@@ -178,6 +178,9 @@ operation, normally it is detected by a polling function or an interrupt, as the
 user code set a callback by calling ASYNC_WAIT_CTX_set_callback() previously,
 then the registered callback will be called.
 
+ASYNC_WAIT_CTX_free() frees up a single B<ASYNC_WAIT_CTX> object.
+If the argument is NULL, nothing is done.
+
 =head1 RETURN VALUES
 
 ASYNC_WAIT_CTX_new() returns a pointer to the newly allocated B<ASYNC_WAIT_CTX>
index 5ab88622cee0ba2f7bfe658b1c2ee5cf6c55ac3b..66dfd1f8d17f98d8921c7f1d3638131ae96c58a5 100644 (file)
@@ -38,6 +38,7 @@ with routines that will fill it with information, such as
 BIO_accept_ex().
 
 BIO_ADDR_free() frees a B<BIO_ADDR> created with BIO_ADDR_new().
+If the argument is NULL, nothing is done.
 
 BIO_ADDR_clear() clears any data held within the provided B<BIO_ADDR> and sets
 it back to an uninitialised state.
index 626052e7f8b9074ac5971cfd94edbbd74f665134..d42a8340bad820ce7df64588e7ebdbfc531fc203 100644 (file)
@@ -78,7 +78,7 @@ BIO_ADDRINFO_next() returns the next B<BIO_ADDRINFO> in the chain
 from the given one.
 
 BIO_ADDRINFO_free() frees the chain of B<BIO_ADDRINFO> starting
-with the given one.
+with the given one. If the argument is NULL, nothing is done.
 
 =head1 RETURN VALUES
 
index 86301b97189f71c989635f7aeb46d327203d4945..23b96587b50c7df5acf4def16af51ff5a4d8bb09 100644 (file)
@@ -76,7 +76,7 @@ additionally have the "descriptor" bit set (B<BIO_TYPE_DESCRIPTOR>). See the
 L<BIO_find_type(3)> page for more information.
 
 BIO_meth_free() destroys a B<BIO_METHOD> structure and frees up any memory
-associated with it.
+associated with it. If the argument is NULL, nothing is done.
 
 BIO_meth_get_write_ex() and BIO_meth_set_write_ex() get and set the function
 used for writing arbitrary length data to the BIO respectively. This function
index b536bcb3b781ca9b5f48e745ae293bd278a25094..51306410e6c10232f67c0a11bd4cdf28e6795683 100644 (file)
@@ -167,7 +167,8 @@ programs should prefer the "new" style, whilst the "old" style is provided
 for backwards compatibility purposes.
 
 A B<BN_GENCB> structure should be created through a call to BN_GENCB_new(),
-and freed through a call to BN_GENCB_free().
+and freed through a call to BN_GENCB_free(). If the argument is NULL,
+nothing is done.
 
 For "new" style callbacks a BN_GENCB structure should be initialised with a
 call to BN_GENCB_set(), where B<gencb> is a B<BN_GENCB *>, B<callback> is of
index 262e18f31bfe929334455474e1e27068dc000b3e..33ca4dfcc98d42f0b5bad401e8436a0f85427626 100644 (file)
@@ -34,6 +34,7 @@ should be allocated on the secure heap; see L<CRYPTO_secure_malloc(3)>.
 
 BUF_MEM_free() frees up an already existing buffer. The data is zeroed
 before freeing up in case the buffer contains sensitive data.
+If the argument is NULL, nothing is done.
 
 BUF_MEM_grow() changes the size of an already existing buffer to
 B<len>. Any data already in the buffer is preserved if it increases in
index a51679b97edde47c264b37f4b97719f9b84e7d7e..adb1259f238919dc67d4ab2ed3458e1bd06c09f3 100644 (file)
@@ -69,6 +69,7 @@ CRYPTO_THREAD_unlock() unlocks the previously locked I<lock>.
 =item *
 
 CRYPTO_THREAD_lock_free() frees the provided I<lock>.
+If the argument is NULL, nothing is done.
 
 =item *
 
index 801b1447e155992d41ee9b67f53293b9504b46c4..2f1596be425d54e3c68c70bc46691b18ae3b3f3c 100644 (file)
@@ -52,7 +52,7 @@ The expected format of the file is:
 
 Once a CTLOG_STORE is no longer required, it should be passed to
 CTLOG_STORE_free(). This will delete all of the CTLOGs stored within, along
-with the CTLOG_STORE itself.
+with the CTLOG_STORE itself. If the argument is NULL, nothing is done.
 
 =head1 NOTES
 
index 30b8068249667a551bfeb2809e4c37d21bf5abfc..b72c1a4249518daf66f37214d02181b0a90533eb 100644 (file)
@@ -50,7 +50,7 @@ property query string are used.
 Regardless of whether CTLOG_new() or CTLOG_new_from_base64() is used, it is the
 caller's responsibility to pass the CTLOG to CTLOG_free() once it is no longer
 needed. This will delete it and, if created by CTLOG_new(), the EVP_PKEY that
-was passed to it.
+was passed to it. If the argument to CTLOG_free() is NULL, nothing is done.
 
 CTLOG_get0_name() returns the name of the log, as provided when the CTLOG was
 created. Ownership of the string remains with the CTLOG.
index bba6778d2debcde59c0e3d0498397f2daab551f5..45ba91bba070e4799bfc088dea7ee40518f600ee 100644 (file)
@@ -105,7 +105,8 @@ The time should be in milliseconds since the Unix Epoch.
 Each setter has a matching getter for accessing the current value.
 
 When no longer required, the B<CT_POLICY_EVAL_CTX> should be passed to
-CT_POLICY_EVAL_CTX_free() to delete it.
+CT_POLICY_EVAL_CTX_free() to delete it. If the argument to
+CT_POLICY_EVAL_CTX_free() is NULL, nothing is done.
 
 =head1 NOTES
 
index 43827f55ef8c37a7568842e8ac58e8ae430dfe3f..977ae0124135961ded35c0af7d7cdb8d864eb630 100644 (file)
@@ -81,7 +81,7 @@ parameter. This might be useful for creating a new B<DH_METHOD> based on an
 existing one, but with some differences.
 
 DH_meth_free() destroys a B<DH_METHOD> structure and frees up any memory
-associated with it.
+associated with it. If the argument is NULL, nothing is done.
 
 DH_meth_get0_name() will return a pointer to the name of this DH_METHOD. This
 is a pointer to the internal name string and so should not be freed by the
index 1f532d300065e1472e345eee988b219c866436e0..7e909f6d6769b7868bc82ca8667f6896ea79851f 100644 (file)
@@ -20,6 +20,7 @@ DSA_SIG_new() allocates an empty B<DSA_SIG> structure.
 
 DSA_SIG_free() frees the B<DSA_SIG> structure and its components. The
 values are erased before the memory is returned to the system.
+If the argument is NULL, nothing is done.
 
 DSA_SIG_get0() returns internal pointers to the B<r> and B<s> values contained
 in B<sig>.
index c00747cfc448656cdd3a98cdeab665ac71d101f1..7abaa9c6ba7a79dca49c3e4854ad271ef4530601 100644 (file)
@@ -110,7 +110,7 @@ parameter. This might be useful for creating a new B<DSA_METHOD> based on an
 existing one, but with some differences.
 
 DSA_meth_free() destroys a B<DSA_METHOD> structure and frees up any memory
-associated with it.
+associated with it. If the argument is NULL, nothing is done.
 
 DSA_meth_get0_name() will return a pointer to the name of this DSA_METHOD. This
 is a pointer to the internal name string and so should not be freed by the
index 3266c43b550c43fd8d2661d633f407f5db44c80f..2eecd4ed43c923073f128b26f5c3b1c9ead0035e 100644 (file)
@@ -31,6 +31,7 @@ ECDSA_SIG_new() allocates an empty B<ECDSA_SIG> structure.
 Note: before OpenSSL 1.1.0, the I<r> and I<s> components were initialised.
 
 ECDSA_SIG_free() frees the B<ECDSA_SIG> structure I<sig>.
+If the argument is NULL, nothing is done.
 
 ECDSA_SIG_get0() returns internal pointers the I<r> and I<s> values contained
 in I<sig> and stores them in I<*pr> and I<*ps>, respectively.
index 55e5d76fcdb8c0a769d6a313ab6af551270e366d..c587f836425e1ceadf0245810361fafc38780c18 100644 (file)
@@ -227,7 +227,8 @@ references such as; ENGINE_by_id(), ENGINE_get_first(), ENGINE_get_last(),
 ENGINE_get_next(), ENGINE_get_prev(). All structural references should be
 released by a corresponding to call to the ENGINE_free() function - the
 ENGINE object itself will only actually be cleaned up and deallocated when
-the last structural reference is released.
+the last structural reference is released. If the argument to ENGINE_free()
+is NULL, nothing is done.
 
 It should also be noted that many ENGINE API function calls that accept a
 structural reference will internally obtain another reference - typically
index c158ec1ae74a7e82474e28344967956ce7735648..ae7a4adc7b38222a4cd107c6ec7b2b219bbd528d 100644 (file)
@@ -45,7 +45,7 @@ The returned value must eventually be freed with EVP_ASYM_CIPHER_free().
 EVP_ASYM_CIPHER_free() decrements the reference count for the B<EVP_ASYM_CIPHER>
 structure. Typically this structure will have been obtained from an earlier call
 to EVP_ASYM_CIPHER_fetch(). If the reference count drops to 0 then the
-structure is freed.
+structure is freed. If the argument is NULL, nothing is done.
 
 EVP_ASYM_CIPHER_up_ref() increments the reference count for an
 B<EVP_ASYM_CIPHER> structure.
index 8b862d9d99c815e2f448a6d2f4f888b479162650..6cf95289c03e6540f9059b3a3ebb6a0051e3bac6 100644 (file)
@@ -80,6 +80,7 @@ EVP_CIPHER_meth_new() creates a new B<EVP_CIPHER> structure.
 EVP_CIPHER_meth_dup() creates a copy of B<cipher>.
 
 EVP_CIPHER_meth_free() destroys a B<EVP_CIPHER> structure.
+If the argument is NULL, nothing is done.
 
 EVP_CIPHER_meth_set_iv_length() sets the length of the IV.
 This is only needed when the implemented cipher mode requires it.
index d7202c538172a645204bac778a2da8bcb8e77a35..9dedb6dfcf97f4db15eeae442fb4c688dfe9a7c6 100644 (file)
@@ -157,6 +157,7 @@ Increments the reference count for an B<EVP_MD> structure.
 
 Decrements the reference count for the fetched B<EVP_MD> structure.
 If the reference count drops to 0 then the structure is freed.
+If the argument is NULL, nothing is done.
 
 =item EVP_MD_CTX_new()
 
@@ -170,6 +171,7 @@ existing context.
 =item EVP_MD_CTX_free()
 
 Cleans up digest context I<ctx> and frees up the space allocated to it.
+If the argument is NULL, nothing is done.
 
 =item EVP_MD_CTX_ctrl()
 
index 2b9e02e02d79f680959c7381335e9b88ae2a103d..2d6e4e8cbfae0bcd193ca3025855f3d0ca236990 100644 (file)
@@ -41,7 +41,7 @@ EVP_ENCODE_CTX_new() allocates, initializes and returns a context to be used for
 the encode/decode functions.
 
 EVP_ENCODE_CTX_free() cleans up an encode/decode context B<ctx> and frees up the
-space allocated to it.
+space allocated to it. If the argument is NULL, nothing is done.
 
 Encoding of binary data is performed in blocks of 48 input bytes (or less for
 the final block). For each 48 byte input block encoded 64 bytes of base 64 data
index 12d7153d0fd406eb7a93ca2925e4ac6e5b6eb951..6774a5f7ea7166934f444b244777cf3c8a17a681 100644 (file)
@@ -268,6 +268,7 @@ Increments the reference count for an B<EVP_CIPHER> structure.
 
 Decrements the reference count for the fetched B<EVP_CIPHER> structure.
 If the reference count drops to 0 then the structure is freed.
+If the argument is NULL, nothing is done.
 
 =item EVP_CIPHER_CTX_new()
 
@@ -276,9 +277,9 @@ Allocates and returns a cipher context.
 =item EVP_CIPHER_CTX_free()
 
 Clears all information from a cipher context and frees any allocated memory
-associated with it, including I<ctx> itself. This function should be called after
-all operations using a cipher are complete so sensitive information does not
-remain in memory.
+associated with it, including I<ctx> itself. This function should be called
+after all operations using a cipher are complete so sensitive information does
+not remain in memory. If the argument is NULL, nothing is done.
 
 =item EVP_CIPHER_CTX_ctrl()
 
index 575abc5f5798c3ee072a39a88783c6a3b7b5cca7..8ddd6dcf645862b4a8bf6571620d142fa2a956aa 100644 (file)
@@ -41,6 +41,7 @@ The returned value must eventually be freed with EVP_KEM_free().
 EVP_KEM_free() decrements the reference count for the B<EVP_KEM> structure.
 Typically this structure will have been obtained from an earlier call to
 EVP_KEM_fetch(). If the reference count drops to 0 then the structure is freed.
+If the argument is NULL, nothing is done.
 
 EVP_KEM_up_ref() increments the reference count for an B<EVP_KEM> structure.
 
index 272855ccb3dd8106a4178dd5949c1beb44509add..21e097d079bdfea88ef0f6a99a657b00a16a028d 100644 (file)
@@ -41,7 +41,7 @@ The returned value must eventually be freed with EVP_KEYEXCH_free().
 EVP_KEYEXCH_free() decrements the reference count for the B<EVP_KEYEXCH>
 structure. Typically this structure will have been obtained from an earlier call
 to EVP_KEYEXCH_fetch(). If the reference count drops to 0 then the
-structure is freed.
+structure is freed. If the argument is NULL, nothing is done.
 
 EVP_KEYEXCH_up_ref() increments the reference count for an B<EVP_KEYEXCH>
 structure.
index 455ffadce5ec644c9c613c2a879079a994f843a7..e37df52860e29592ba95c516bf33d0fba04d45c2 100644 (file)
@@ -62,6 +62,7 @@ B<EVP_KEYMGMT> I<keymgmt>.
 
 EVP_KEYMGMT_free() decrements the reference count for the given
 B<EVP_KEYMGMT> I<keymgmt>, and when the count reaches zero, frees it.
+If the argument is NULL, nothing is done.
 
 EVP_KEYMGMT_get0_provider() returns the provider that has this particular
 implementation.
index a553c378f3d7d84d9c8916f114f83f687e490f35..9ddc0001ab550349a286542972b3609d5b8623b1 100644 (file)
@@ -74,6 +74,7 @@ EVP_MD_meth_dup() creates a copy of B<md>.
 
 EVP_MD_meth_free() decrements the reference count for the B<EVP_MD> structure.
 If the reference count drops to 0 then the structure is freed.
+If the argument is NULL, nothing is done.
 
 EVP_MD_meth_set_input_blocksize() sets the internal input block size
 for the method B<md> to B<blocksize> bytes.
index cc50d363daf1e228571e5805429db6eab12739e9..637fd48010175105e3054b9c7c72aebfcc992f01 100644 (file)
@@ -393,7 +393,7 @@ This function is not thread safe, it's recommended to only use this
 when initializing the application.
 
 EVP_PKEY_asn1_free() frees an existing B<EVP_PKEY_ASN1_METHOD> pointed
-by B<ameth>.
+by B<ameth>. If the argument is NULL, nothing is done.
 
 EVP_PKEY_asn1_add0() adds B<ameth> to the user defined stack of
 methods unless another B<EVP_PKEY_ASN1_METHOD> with the same NID is
index db0b09f855fc4d40d5fda0e6b6ded8cd0201422e..45f868d04d8686c632fcb7f51c02f1d520b06fc9 100644 (file)
@@ -407,7 +407,7 @@ of an B<EVP_PKEY_METHOD> is always called by the EVP framework while doing a
 digest signing operation by calling L<EVP_DigestSignFinal(3)>.
 
 EVP_PKEY_meth_free() frees an existing B<EVP_PKEY_METHOD> pointed by
-B<pmeth>.
+B<pmeth>. If the argument is NULL, nothing is done.
 
 EVP_PKEY_meth_copy() copies an B<EVP_PKEY_METHOD> object from B<src>
 to B<dst>.
index 1f534ef33810eb92b848890e2c3d510bdbef6bcf..9a1bc31a4037c71d7b84b2660068f697df2c340e 100644 (file)
@@ -49,7 +49,7 @@ The returned value must eventually be freed with EVP_SIGNATURE_free().
 EVP_SIGNATURE_free() decrements the reference count for the B<EVP_SIGNATURE>
 structure. Typically this structure will have been obtained from an earlier call
 to EVP_SIGNATURE_fetch(). If the reference count drops to 0 then the
-structure is freed.
+structure is freed. If the argument is NULL, nothing is done.
 
 EVP_SIGNATURE_up_ref() increments the reference count for an B<EVP_SIGNATURE>
 structure.
index 87a567242f60fad579a8b42a7a445e8732db7aa4..b0c640d32e08fb839afdc2b4add01106dd728516 100644 (file)
@@ -87,7 +87,7 @@ created with HMAC_CTX_new().
 
 HMAC_CTX_free() erases the key and other data from the B<HMAC_CTX>,
 releases any associated resources and finally frees the B<HMAC_CTX>
-itself.
+itself. If the argument is NULL, nothing is done.
 
 The following functions may be used if the message is not completely
 stored in memory:
index 6861fb198c103f3f44cd5428acd11ecca6edcba5..394dbd82d4625b942c10a244b2536201c1c7119b 100644 (file)
@@ -35,7 +35,7 @@ I<meth> is set to NULL then the default value of NCONF_default() is used.
 NCONF_new() is similar to NCONF_new_ex() but sets the I<libctx> to NULL.
 
 NCONF_free() frees the data associated with I<conf> and then frees the I<conf>
-object.
+object. If the argument is NULL, nothing is done.
 
 NCONF_load() parses the file named I<filename> and adds the values found to
 I<conf>. If an error occurs I<file> and I<eline> list the file and line that
index e34e591fe01becc46ac18b57271e2acaff58ff8f..28779fb07d68b90d1ea903e0489c54095a80f7a3 100644 (file)
@@ -29,6 +29,7 @@ OCSP_request_onereq_get0 - OCSP request functions
 OCSP_REQUEST_new() allocates and returns an empty B<OCSP_REQUEST> structure.
 
 OCSP_REQUEST_free() frees up the request structure B<req>.
+If the argument is NULL, nothing is done.
 
 OCSP_request_add0_id() adds certificate ID B<cid> to B<req>. It returns
 the B<OCSP_ONEREQ> structure added so an application can add additional
index 298527f6bb25b7cccd2916859f471ef376b04b73..abf07db109e00d4e8c3482d57c1ee094dd473d0d 100644 (file)
@@ -38,6 +38,7 @@ issuer name B<issuerName>, issuer key hash B<issuerKey> and serial number
 B<serialNumber>.
 
 OCSP_CERTID_free() frees up B<id>.
+If the argument is NULL, nothing is done.
 
 OCSP_id_cmp() compares B<OCSP_CERTID> B<a> and B<b>.
 
index 7ff74923a53f32dfddee29619090dfba400c7df5..a7402540b28ec437999a8bdc0dcabe2690514352 100644 (file)
@@ -46,6 +46,7 @@ OCSP_response_create() creates and returns an I<OCSP_RESPONSE> structure for
 I<status> and optionally including basic response I<bs>.
 
 OCSP_RESPONSE_free() frees up OCSP response I<resp>.
+If the argument is NULL, nothing is done.
 
 OCSP_RESPID_set_by_name() sets the name of the OCSP_RESPID to be the same as the
 subject name in the supplied X509 certificate I<cert> for the OCSP responder.
index 688ef0edcb91aefac9076db96e6d482729172594..2d352fa137e929eb390fc95c970c9976126244da 100644 (file)
@@ -123,7 +123,7 @@ Then a hash table of B<I<TYPE>> objects can be created using this:
 B<lh_I<TYPE>_free>() frees the B<LHASH_OF>(B<I<TYPE>>) structure
 I<table>. Allocated hash table entries will not be freed; consider
 using B<lh_I<TYPE>_doall>() to deallocate any remaining entries in the
-hash table (see below).
+hash table (see below). If the argument is NULL, nothing is done.
 
 B<lh_I<TYPE>_flush>() empties the B<LHASH_OF>(B<I<TYPE>>) structure I<table>. New
 entries can be added to the flushed table.  Allocated hash table entries
index c3e72d27442309ed01cea8278fe8617ca90f537a..12f3c6864fefad658f808f94c764be2718637454 100644 (file)
@@ -249,6 +249,7 @@ If the B<CONF_MFLAGS_IGNORE_RETURN_CODES> flag is not included, any errors in
 the configuration file will cause an error return from B<OPENSSL_init_crypto>
 or indirectly L<OPENSSL_init_ssl(3)>.
 The object can be released with OPENSSL_INIT_free() when done.
+If the argument to OPENSSL_INIT_free() is NULL, nothing is done.
 
 =head1 NOTES
 
index 76751012bde5ff53bfbe2727fe7991180381be1a..4f292101957ee2131ac0af5e7ec77a8ebb4763c8 100644 (file)
@@ -99,7 +99,8 @@ OPENSSL_zalloc() calls memset() to zero the memory before returning.
 OPENSSL_clear_realloc() and OPENSSL_clear_free() should be used
 when the buffer at B<addr> holds sensitive information.
 The old buffer is filled with zero's by calling OPENSSL_cleanse()
-before ultimately calling OPENSSL_free().
+before ultimately calling OPENSSL_free(). If the argument to OPENSSL_free() is
+NULL, nothing is done.
 
 OPENSSL_cleanse() fills B<ptr> of size B<len> with a string of 0's.
 Use OPENSSL_cleanse() with care if the memory is a mapping of a file.
index c5d4bb2dbbb8c2c753e34844cbff759e6e515432..cd18753d6fca3a33be938b96d75db234dcdd8ec8 100644 (file)
@@ -82,13 +82,15 @@ If CRYPTO_secure_malloc_init() is not called, this is equivalent to
 calling OPENSSL_free().
 It exists for consistency with OPENSSL_secure_malloc() , and
 is a macro that expands to CRYPTO_secure_free() and adds the C<__FILE__>
-and C<__LINE__> parameters..
+and C<__LINE__> parameters..  If the argument to OPENSSL_secure_free()
+is NULL, nothing is done.
 
 OPENSSL_secure_clear_free() is similar to OPENSSL_secure_free() except
 that it has an additional C<num> parameter which is used to clear
 the memory if it was not allocated from the secure heap.
 If CRYPTO_secure_malloc_init() is not called, this is equivalent to
-calling OPENSSL_clear_free().
+calling OPENSSL_clear_free(). If the argument to OPENSSL_secure_clear_free()
+is NULL, nothing is done.
 
 OPENSSL_secure_actual_size() tells the actual size allocated to the
 pointer; implementations may allocate more space than initially
index 5b106a8ad080265c5fb8a92d4422edc5120ee010..c201b78c83b3fcdbdf4c25dfd537822044143478 100644 (file)
@@ -176,6 +176,7 @@ the message timeout is set to 120 seconds,
 and the proof-of-possession method is set to OSSL_CRMF_POPO_SIGNATURE.
 
 OSSL_CMP_CTX_free() deallocates an OSSL_CMP_CTX structure.
+If the argument is NULL, nothing is done.
 
 OSSL_CMP_CTX_reinit() prepares the given I<ctx> for a further transaction by
 clearing the internal CMP transaction (aka session) status, PKIStatusInfo,
index d7f1a2e4dba7ba4f8b32aed90307dd65053e5e1e..89749615ebe5f0286269dd6202cba994ef9351be 100644 (file)
@@ -104,6 +104,7 @@ associated with the library context I<libctx> and property query string
 I<propq>, both of which may be NULL to select the defaults.
 
 OSSL_CMP_SRV_CTX_free() deletes the given I<srv_ctx>.
+If the argument is NULL, nothing is done.
 
 OSSL_CMP_SRV_CTX_init() sets in the given I<srv_ctx> a custom server context
 pointer as well as callback functions performing the specific processing of CMP
index dcfd72bf9738477ee87ea161343755c392e77065..0a923b8a8c1ca1fb51693e21b91ad40ecc345d78 100644 (file)
@@ -61,6 +61,7 @@ I<decoder>.
 
 OSSL_DECODER_free() decrements the reference count for the given
 I<decoder>, and when the count reaches zero, frees it.
+If the argument is NULL, nothing is done.
 
 OSSL_DECODER_get0_provider() returns the provider of the given
 I<decoder>.
index 3ffd794cf0fb3819d5f6e12384f5fe86963cdfe6..de7c22b61e7004148b465ba828aff4b66b3d2d86 100644 (file)
@@ -126,6 +126,7 @@ decoders that have been added to the I<ctx> so far.  Parameters that an
 implementation doesn't recognise should be ignored by it.
 
 OSSL_DECODER_CTX_free() frees the given context I<ctx>.
+If the argument is NULL, nothing is done.
 
 OSSL_DECODER_CTX_add_decoder() populates the B<OSSL_DECODER_CTX> I<ctx> with
 a decoder, to be used to attempt to decode some encoded input.
index 06d8f80f881225999ef07797a7bdb0eb4659c734..f96ea2ae7be96f83235a5684e3c33149ed446431 100644 (file)
@@ -61,6 +61,7 @@ I<encoder>.
 
 OSSL_ENCODER_free() decrements the reference count for the given
 I<encoder>, and when the count reaches zero, frees it.
+If the argument is NULL, nothing is done.
 
 OSSL_ENCODER_get0_provider() returns the provider of the given
 I<encoder>.
index 7f3915fda88236f4560d8fba52ea34d3dc547283..4d0320e78b4030f72dd0ce192a1fd3d36e5c96b6 100644 (file)
@@ -102,6 +102,7 @@ with an L<OSSL_PARAM(3)> array I<params>.  Parameters that the
 implementation doesn't recognise should be ignored.
 
 OSSL_ENCODER_CTX_free() frees the given context I<ctx>.
+If the argument is NULL, nothing is done.
 
 OSSL_ENCODER_CTX_add_encoder() populates the B<OSSL_ENCODER_CTX>
 I<ctx> with a encoder, to be used to encode an input object.
index 6216420e4ffe9201babf068dd376cafd7f0b0b39..8716d8e7c9fd6e3bbe6e17ceab4e89a783b4adb1 100644 (file)
@@ -71,6 +71,7 @@ which collects the HTTP request header lines.
 
 OSSL_HTTP_REQ_CTX_free() frees up the HTTP request context I<rctx>.
 The I<rbio> is not free'd, I<wbio> will be free'd if I<free_wbio> is set.
+If the argument is NULL, nothing is done.
 
 OSSL_HTTP_REQ_CTX_set_request_line() adds the 1st HTTP request line to I<rctx>.
 The HTTP method is determined by I<method_POST>,
index 45fdd8f39a6afa114b8b67b5d875718d3d90bf00..fc205b33da3ead361b040d5f270256af708470ec 100644 (file)
@@ -88,7 +88,7 @@ This can be used to associate a library context with providers that are loaded
 from a configuration.
 
 OSSL_LIB_CTX_free() frees the given I<ctx>, unless it happens to be the
-default OpenSSL library context.
+default OpenSSL library context. If the argument is NULL, nothing is done.
 
 OSSL_LIB_CTX_get0_global_default() returns a concrete (non NULL) reference to
 the global default library context.
index 455761c20d32b9df5b2a233f13f65de04351e543..63e8eccb8c5a4220cbe3211d2697c61447c87701 100644 (file)
@@ -53,6 +53,7 @@ so that values can be added.
 Any existing values are cleared.
 
 OSSL_PARAM_BLD_free() deallocates the memory allocates by OSSL_PARAM_BLD_new().
+If the argument is NULL, nothing is done.
 
 OSSL_PARAM_BLD_to_param() converts a built up OSSL_PARAM_BLD structure
 I<bld> into an allocated OSSL_PARAM array.
index 4ae33faf1e4e8f6e963a1972a572be050e4bcab0..dbaeed9a533e20664233f930d34b4bfc0db24cbb 100644 (file)
@@ -32,6 +32,7 @@ array that have the same key.
 
 OSSL_PARAM_free() frees the parameter array I<params> that was created using
 OSSL_PARAM_dup(), OSSL_PARAM_merge() or OSSL_PARAM_BLD_to_param().
+If the argument to OSSL_PARAM_free() is NULL, nothing is done.
 
 =head1 RETURN VALUES
 
index 4c4b10fca96ad050603042e31a6579e5460f7f92..dbacf9556a35ff6d462395a37fbb337d2a49e4dd 100644 (file)
@@ -32,6 +32,7 @@ The callback I<cb> may be triggered multiple times by a self test to indicate
 different phases.
 
 OSSL_SELF_TEST_free() frees the space allocated by OSSL_SELF_TEST_new().
+If the argument is NULL, nothing is done.
 
 OSSL_SELF_TEST_onbegin() may be inserted at the start of a block of self test
 code. It can be used for diagnostic purposes.
index 39bb93fbf5f21bffcd9bd99c02ab04ac3b0eea8b..546ec54c70c206c16233a661cee12c726e3da6d2 100644 (file)
@@ -101,6 +101,7 @@ holds if the B<OSSL_STORE_INFO> type (as returned by
 OSSL_STORE_INFO_get_type()) matches the function, otherwise NULL.
 
 OSSL_STORE_INFO_free() frees a B<OSSL_STORE_INFO> and its contained type.
+If the argument is NULL, nothing is done.
 
 OSSL_STORE_INFO_new_NAME() , OSSL_STORE_INFO_new_PARAMS(),
 , OSSL_STORE_INFO_new_PUBKEY(), OSSL_STORE_INFO_new_PKEY(),
index e8c8a29aaccbf8eb0ccb8da7c1d31981267e8b04..fe19d985388b735839a92d56858e7e2545557f4d 100644 (file)
@@ -125,6 +125,7 @@ I<loader>.
 
 OSSL_STORE_LOADER_free() decrements the reference count for the given
 I<loader>, and when the count reaches zero, frees it.
+If the argument is NULL, nothing is done.
 
 OSSL_STORE_LOADER_get0_provider() returns the provider of the given
 I<loader>.
@@ -296,6 +297,7 @@ OSSL_STORE_LOADER_set_close() sets the closing function for the
 I<store_loader>.
 
 OSSL_STORE_LOADER_free() frees the given I<store_loader>.
+If the argument is NULL, nothing is done.
 
 OSSL_STORE_register_loader() register the given I<store_loader> and
 thereby makes it available for use with OSSL_STORE_open(),
index 79186b08997e018e26788a1e9dd01664264fcbdf..021ed0c8baa653f9546a1b659d6804fb73fe5c9d 100644 (file)
@@ -75,6 +75,7 @@ criterion, so they must have at least the same life time as the created
 B<OSSL_STORE_SEARCH>.
 
 OSSL_STORE_SEARCH_free() is used to free the B<OSSL_STORE_SEARCH>.
+If the argument is NULL, nothing is done.
 
 =head2 Loader Functions
 
index 29ea4161b0b5354723894bcbfe106f1add578a2a..b5cfd43b6edbc938d47c96225ad00236923df624 100644 (file)
@@ -147,7 +147,7 @@ passed as a parameter. This might be useful for creating a new
 B<RSA_METHOD> based on an existing one, but with some differences.
 
 RSA_meth_free() destroys an B<RSA_METHOD> structure and frees up any
-memory associated with it.
+memory associated with it. If the argument is NULL, nothing is done.
 
 RSA_meth_get0_name() will return a pointer to the name of this
 RSA_METHOD. This is a pointer to the internal name string and so
index 235762721992b16803cac4f1a5de17628105c9ca..ecaa25e1d221d64b735971a06ff6fde36ffb5f5c 100644 (file)
@@ -166,6 +166,12 @@ SCT_set_source() can be used to record where the SCT was found
 (TLS extension, X.509 certificate extension or OCSP response). This is not
 required for verifying the SCT.
 
+SCT_free() frees the specified SCT.
+If the argument is NULL, nothing is done.
+
+SCT_LIST_free() frees the specified stack of SCTs.
+If the argument is NULL, nothing is done.
+
 =head1 NOTES
 
 Some of the setters return int, instead of void. These will all return 1 on
index 725a1921d133ed89ad21a09d9ba5f51aab9f242a..3b5bfc65ba780a4e8319a32c8cf15d3c9374279d 100644 (file)
@@ -27,6 +27,7 @@ and property query to NULL. This results in the default (NULL) library context
 being used for any operations requiring algorithm fetches.
 
 TS_RESP_CTX_free() frees the B<TS_RESP_CTX> object I<ctx>.
+If the argument is NULL, nothing is done.
 
 =head1 RETURN VALUES
 
index 4d2fe38f25ab2a3ee2d88b75c01685893a63cfb0..d086d1b35c5eba10f21a6df763c22eed97791db4 100644 (file)
@@ -85,6 +85,7 @@ X509_LOOKUP_shutdown() tears down the internal state and resources of
 the given B<X509_LOOKUP>.
 
 X509_LOOKUP_free() destructs the given B<X509_LOOKUP>.
+If the argument is NULL, nothing is done.
 
 X509_LOOKUP_set_method_data() and X509_LOOKUP_get_method_data()
 associates and retrieves a pointer to application data to and from the
index 2021749935631bbce33a3f850d11593c741deda5..baaccd5220bfafc0c61493b55f37d02cd9710bc3 100644 (file)
@@ -110,6 +110,7 @@ be given a human-readable string containing a brief description of the lookup
 method.
 
 X509_LOOKUP_meth_free() destroys a B<X509_LOOKUP_METHOD> structure.
+If the argument is NULL, nothing is done.
 
 X509_LOOKUP_get_new_item() and X509_LOOKUP_set_new_item() get and set the
 function that is called when an B<X509_LOOKUP> object is created with
index 31d466faa42a7eaa1165842b94b3d10f3d7eb252..63c37e9530bd53312a7285ccdab5c202108e2154 100644 (file)
@@ -27,6 +27,7 @@ X509_STORE_lock() locks the store from modification by other threads,
 X509_STORE_unlock() unlocks it.
 
 X509_STORE_free() frees up a single X509_STORE object.
+If the argument is NULL, nothing is done.
 
 =head1 RETURN VALUES
 
index 849364e2aae7001a0db03bfb9025826561d1c6d8..c8dd79ff71b73eeaae134f5ec1b71fd66274d91a 100644 (file)
@@ -367,7 +367,7 @@ followed by I<X509_check_purpose(copied_cert, -1, 0)>,
 which re-builds the cached data.
 
 B<I<TYPE>_free>() releases the object and all pointers and sub-objects
-within it.
+within it. If the argument is NULL, nothing is done.
 
 B<I<TYPE>_print_ctx>() prints the object I<a> on the specified BIO I<out>.
 Each line will be prefixed with I<indent> spaces.
index ea2b3a2cc9b0dc7ae9bb99e31e9877eb4f09cb14..0e19a76fb1dee83ba5105fda0b0c80d258391cbe 100644 (file)
@@ -18,7 +18,7 @@ X509_chain_up_ref - X509 certificate ASN1 allocation functions
 
 =head1 DESCRIPTION
 
-The X509 ASN1 allocation routines, allocate and free an
+The X509 ASN1 allocation routines allocate and free an
 X509 structure, which represents an X509 certificate.
 
 X509_new_ex() allocates and initializes a X509 structure with a
@@ -33,7 +33,8 @@ and property query to NULL. This results in the default (NULL) library context
 being used for any X509 operations requiring algorithm fetches.
 
 X509_free() decrements the reference count of B<X509> structure B<a> and
-frees it up if the reference count is zero. If B<a> is NULL nothing is done.
+frees it up if the reference count is zero. If the argument is NULL,
+nothing is done.
 
 X509_up_ref() increments the reference count of B<a>.