diff options
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/by_dir.c | 12 | ||||
-rw-r--r-- | crypto/x509/x509_obj.c | 3 | ||||
-rw-r--r-- | crypto/x509/x509_vfy.c | 6 | ||||
-rw-r--r-- | crypto/x509/x509_vpm.c | 14 |
4 files changed, 12 insertions, 23 deletions
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index 31b3c3c9dc..304cf4ab5c 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -177,8 +177,7 @@ static int by_dir_hash_cmp(const BY_DIR_HASH *const *a, static void by_dir_entry_free(BY_DIR_ENTRY *ent) { OPENSSL_free(ent->dir); - if (ent->hashes) - sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); + sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); OPENSSL_free(ent); } @@ -187,10 +186,8 @@ static void free_dir(X509_LOOKUP *lu) BY_DIR *a; a = (BY_DIR *)lu->method_data; - if (a->dirs != NULL) - sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); - if (a->buffer != NULL) - BUF_MEM_free(a->buffer); + sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); + BUF_MEM_free(a->buffer); OPENSSL_free(a); } @@ -435,7 +432,6 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, } } finish: - if (b != NULL) - BUF_MEM_free(b); + BUF_MEM_free(b); return (ok); } diff --git a/crypto/x509/x509_obj.c b/crypto/x509/x509_obj.c index 4e80c1b4fe..ca6ff5dd5c 100644 --- a/crypto/x509/x509_obj.c +++ b/crypto/x509/x509_obj.c @@ -207,7 +207,6 @@ char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); - if (b != NULL) - BUF_MEM_free(b); + BUF_MEM_free(b); return (NULL); } diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index 522f9b970b..3f4fb81406 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -1020,10 +1020,8 @@ static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl, *pscore = best_score; *preasons = best_reasons; CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL); - if (*pdcrl) { - X509_CRL_free(*pdcrl); - *pdcrl = NULL; - } + X509_CRL_free(*pdcrl); + *pdcrl = NULL; get_delta_sk(ctx, pdcrl, pscore, best_crl, crls); } diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c index b0d9c4de91..29ee8a738f 100644 --- a/crypto/x509/x509_vpm.c +++ b/crypto/x509/x509_vpm.c @@ -83,8 +83,6 @@ static void str_free(char *s) OPENSSL_free(s); } -#define string_stack_free(sk) sk_OPENSSL_STRING_pop_free(sk, str_free) - static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode, const char *name, size_t namelen) { @@ -101,8 +99,8 @@ static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode, if (name && name[namelen - 1] == '\0') --namelen; - if (mode == SET_HOST && id->hosts) { - string_stack_free(id->hosts); + if (mode == SET_HOST) { + sk_OPENSSL_STRING_pop_free(id->hosts, str_free); id->hosts = NULL; } if (name == NULL || namelen == 0) @@ -147,7 +145,7 @@ static void x509_verify_param_zero(X509_VERIFY_PARAM *param) sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free); param->policies = NULL; paramid = param->id; - string_stack_free(paramid->hosts); + sk_OPENSSL_STRING_pop_free(paramid->hosts, str_free); paramid->hosts = NULL; OPENSSL_free(paramid->peername); OPENSSL_free(paramid->email); @@ -287,10 +285,8 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest, /* Copy the host flags if and only if we're copying the host list */ if (test_x509_verify_param_copy_id(hosts, NULL)) { - if (dest->id->hosts) { - string_stack_free(dest->id->hosts); - dest->id->hosts = NULL; - } + sk_OPENSSL_STRING_pop_free(dest->id->hosts, str_free); + dest->id->hosts = NULL; if (id->hosts) { dest->id->hosts = sk_OPENSSL_STRING_deep_copy(id->hosts, str_copy, str_free); |