]> 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:27:20 +0000 (18:27 +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)

63 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/COMP_CTX_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_ERR_STATE_save.pod
doc/man3/OSSL_HPKE_CTX_new.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 3d55084d7bd80a5c6a1b16428f96165bf6cd16c6..e6edaac51fe2863bdf9a98b200cb64183ecdcf54 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2019-2023 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
@@ -477,7 +477,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 eb5a4a8fe7fbde07e57367dbd96cdb413b4d0a51..1313d025379540c2fb750ede8c4d85afc03aa205 100644 (file)
@@ -18,7 +18,7 @@ BIO_ADDR_path_string - BIO_ADDR routines
  BIO_ADDR *BIO_ADDR_new(void);
  int BIO_ADDR_copy(BIO_ADDR *dst, const BIO_ADDR *src);
  BIO_ADDR *BIO_ADDR_dup(const BIO_ADDR *ap);
- void BIO_ADDR_free(BIO_ADDR *);
+ void BIO_ADDR_free(BIO_ADDR *ap);
  void BIO_ADDR_clear(BIO_ADDR *ap);
  int BIO_ADDR_rawmake(BIO_ADDR *ap, int family,
                       const void *where, size_t wherelen, unsigned short port);
@@ -47,7 +47,7 @@ BIO_ADDR_dup() creates a new B<BIO_ADDR>, with a copy of the
 address data in B<ap>.
 
 BIO_ADDR_free() frees a B<BIO_ADDR> created with BIO_ADDR_new()
-or BIO_ADDR_dup();
+or BIO_ADDR_dup(). 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 41e36f7c798657136b67a9b016e99e333b8589f7..b532190e5a54e015eab2ef6ad1eddfe0afea342a 100644 (file)
@@ -100,7 +100,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 997f1187f46be916ef87249cfcbd9a4cffed3bcb..c2eecfb61a89efd005b3fc781ffcbce9143834d5 100644 (file)
@@ -54,7 +54,9 @@ These functions provide compression support for OpenSSL. Compression is used wit
 the OpenSSL library to support TLS record and certificate compression.
 
 COMP_CTX_new() is used to create a new B<COMP_CTX> structure used to compress data.
+
 COMP_CTX_free() is used to free the returned B<COMP_CTX>.
+If the argument is NULL, nothing is done.
 
 COMP_CTX_get_method() returns the B<COMP_METHOD> of the given I<ctx>.
 
index 470b741c109a1ded4a567fc07c6b5ff008b7e277..a01b1f9fd7026f678971d16226c26dfe1551b34a 100644 (file)
@@ -81,6 +81,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 779a6951678f0b3d174db81a8c83284ac885c3d9..2da003353a1c3775a55d5d331e24cc8e65d0bde5 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 f8f5a1f02242623692103e7fb66bb6693c21325b..45d43632081af34ffce5498578cc99e4dd8861d5 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 35d4db2a6626f122e5f2091101a99a3a10f42fb4..9c7fedf0feb8c1c268b7b71e960756de9a515d57 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 d31f845575735e6efeb9c8caba37a5a01a1747aa..aeae8e81e6d2f900e8b36b0a19d68057fb62001d 100644 (file)
@@ -160,6 +160,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()
 
@@ -173,6 +174,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 c6b001b1b2132b984a1c3ad9723cf9a76cd25933..fbcee9310a5f8106265c1cb564250b24a6c7dddd 100644 (file)
@@ -272,6 +272,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()
 
@@ -280,9 +281,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_dup()
 
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 da03286a996e4f5fed517d262a08198fd225d7e3..a801ae28e9e5a49218935d6b2cb5b87a88edc58d 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 bf3169ae0d599a36ab0b0d4a9d92d7fa8a62f8ea..772f421303a69ec4860b24016a832f768f8a2c61 100644 (file)
@@ -144,7 +144,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 b2d48daeff330c86b30808a81a3cf82c8da90940..bb0421d9eb2daaaa5bee0c76aa3c34cde93c5a16 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 7dc6468f0edf6bd13233c3fbf86c4dead1eacb03..86bc0dec14ce9daee41325e1b0560b2027e5b822 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 b9d89dbc3d8310cef74345e1a486dc5fb44b12ab..3af2c897154f981bf8a563904ba93982cacafebe 100644 (file)
@@ -190,6 +190,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 d1fd7e83b1ab84cfdd9a07fbb0e8f0ecf79e3727..7222a898e8e7b6256eb17b7e1a45519cf2393a95 100644 (file)
@@ -114,6 +114,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 c58ebf462c71a20bd0a1a11ebb23504fd454e700..25f5e50dceb608781bd186a38dab90d4118c9494 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 034cf12c7389486790bba6e52278c821f9016097..61ffc2e1f6ef42494e3c1c4dd1019b43ea83be0f 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 d7271547287e1dee93e825e717acfc2b7a020add..e5e1598808cacf28007c6ba48e42d985e74f304c 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 b4b5f61e130408656118208924789cbcf13baff1..75dcb83af79431114dd7eccc8c877c1405f490b3 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 93c4b8f4736049d0651eae959ad99a570d26130d..379a93aa87aa6564155a05e400448a9edb2dfc21 100644 (file)
@@ -46,6 +46,7 @@ for all the added entries. Any allocated data in the saved error
 entries is duplicated on adding to the thread state.
 
 OSSL_ERR_STATE_free() frees the saved error state I<es>.
+If the argument is NULL, nothing is done.
 
 =head1 RETURN VALUES
 
index e291ec7e48383f8787327b291ecf204b16c3df4f..b3ad66e05f5278d50976b52b25ef01b21d590ff5 100644 (file)
@@ -240,7 +240,8 @@ I<libctx> and I<propq> are used when fetching algorithms from providers and may
 be set to NULL.
 
 OSSL_HPKE_CTX_free() frees the I<ctx> B<OSSL_HPKE_CTX> that was created
-previously by a call to OSSL_HPKE_CTX_new().
+previously by a call to OSSL_HPKE_CTX_new().  If the argument to
+OSSL_HPKE_CTX_free() is NULL, nothing is done.
 
 =head2 Sender APIs
 
index 105ed60e534f2b6592a54489800b0b3a26dd2e74..2a1485cbe9a26d41e2d37f857570785ab452d044 100644 (file)
@@ -75,6 +75,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 cf8bd8b067f1f4518a4aa65ecf95499d0e663de5..66aa4a42ddfead53c38a1afb027603e7217588fc 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 639f7bb59537e5c7f8bf144a5809c2a6ee89a04d..d1ac7b49639c6450e373742eb32251edaec10f5b 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 176d39f6981cfcaff034db4910e91bfec4cbfde1..89c60f1ef19a24b274f1c30d3ee10cfb5332fcdf 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 6c8eda1615b02e69e07c2da609e4c6e2edb3688c..7372358fa7194fd2a02484bff4f873741ea1ec52 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 f888d28467fba10158f0ad3a4333a74e1c27642a..5d3d12a4b83e852ac39d2b2ac183a3763e329635 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 49776e71260720062ad4b3be8cb51b5a10197d0d..3d2a070c6c3d6a2ae3a2400e999126498855f8e4 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 59b5160f39ba7b95619fc84f22254b1eb918efba..22ffad570341bc3d76f932f6a59767e931092092 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 86a259f025f11cdceab2ad8136045ac8a8cf0eae..029958d9871c151dfc56107978dfe4f7c32b32b7 100644 (file)
@@ -370,7 +370,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 dcebb55fe6ad463ddc766086bc58cfc2e77634b1..7fbbfa9e8dbd9eed9c916969cc0b50b637d4044c 100644 (file)
@@ -21,7 +21,7 @@ OSSL_STACK_OF_X509_free
 
 =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
@@ -36,7 +36,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>.
 
@@ -45,6 +46,7 @@ chain B<x> and returns a copy of the stack, or an empty stack if B<a> is NULL.
 
 OSSL_STACK_OF_X509_free() deallocates the given list of pointers to
 certificates after calling X509_free() on all its elements.
+If the argument is NULL, nothing is done.
 
 =head1 NOTES