diff --git a/STYLE b/STYLE index cb2d297e..578da68c 100644 --- a/STYLE +++ b/STYLE @@ -105,7 +105,8 @@ type. Some types are allocated within the library while others are initialized into a struct allocated by the caller, often on the stack. Name these functions TYPE_NAME_new/TYPE_NAME_free and -TYPE_NAME_init/TYPE_NAME_cleanup, respectively. +TYPE_NAME_init/TYPE_NAME_cleanup, respectively. All TYPE_NAME_free +functions must do nothing on NULL input. If a variable is the length of a pointer value, it has the suffix _len. An output parameter is named out or has an out_ prefix. For diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c index cf4283dc..8c8f98ea 100644 --- a/crypto/x509/x509_vpm.c +++ b/crypto/x509/x509_vpm.c @@ -185,6 +185,8 @@ X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void) void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param) { + if (param == NULL) + return; x509_verify_param_zero(param); OPENSSL_free(param->id); OPENSSL_free(param); diff --git a/ssl/d1_both.c b/ssl/d1_both.c index 4e084af7..ec2d920d 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -196,6 +196,9 @@ static hm_fragment *dtls1_hm_fragment_new(unsigned long frag_len, } void dtls1_hm_fragment_free(hm_fragment *frag) { + if (frag == NULL) { + return; + } if (frag->fragment) { OPENSSL_free(frag->fragment); } diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 348c7a8f..2d0bec70 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -460,6 +460,9 @@ int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm) { void ssl_cipher_preference_list_free( struct ssl_cipher_preference_list_st *cipher_list) { + if (cipher_list == NULL) { + return; + } sk_SSL_CIPHER_free(cipher_list->ciphers); OPENSSL_free(cipher_list->in_group_flags); OPENSSL_free(cipher_list);