diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ecdsa/ecs_lib.c | 2 | ||||
-rw-r--r-- | crypto/jpake/jpake.c | 2 | ||||
-rw-r--r-- | crypto/ocsp/ocsp_ht.c | 2 | ||||
-rw-r--r-- | crypto/srp/srp_vfy.c | 11 | ||||
-rw-r--r-- | crypto/x509v3/v3_ncons.c | 6 | ||||
-rw-r--r-- | crypto/x509v3/v3_scts.c | 10 |
6 files changed, 19 insertions, 14 deletions
diff --git a/crypto/ecdsa/ecs_lib.c b/crypto/ecdsa/ecs_lib.c index 55324f7fef..3d012120f6 100644 --- a/crypto/ecdsa/ecs_lib.c +++ b/crypto/ecdsa/ecs_lib.c @@ -312,6 +312,8 @@ void ECDSA_METHOD_set_name(ECDSA_METHOD *ecdsa_method, char *name) void ECDSA_METHOD_free(ECDSA_METHOD *ecdsa_method) { + if (!ecdsa_method) + return; if (ecdsa_method->flags & ECDSA_METHOD_FLAG_ALLOCATED) OPENSSL_free(ecdsa_method); } diff --git a/crypto/jpake/jpake.c b/crypto/jpake/jpake.c index eb6654d44f..b097c7f535 100644 --- a/crypto/jpake/jpake.c +++ b/crypto/jpake/jpake.c @@ -125,6 +125,8 @@ JPAKE_CTX *JPAKE_CTX_new(const char *name, const char *peer_name, void JPAKE_CTX_free(JPAKE_CTX *ctx) { + if (!ctx) + return; JPAKE_CTX_release(ctx); OPENSSL_free(ctx); } diff --git a/crypto/ocsp/ocsp_ht.c b/crypto/ocsp/ocsp_ht.c index 4a06a8e1ef..266b43b00a 100644 --- a/crypto/ocsp/ocsp_ht.c +++ b/crypto/ocsp/ocsp_ht.c @@ -136,6 +136,8 @@ OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline) void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) { + if (!rctx) + return; BIO_free(rctx->mem); if (rctx->iobuf) OPENSSL_free(rctx->iobuf); diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c index e8bdbf58b1..cd07f702c5 100644 --- a/crypto/srp/srp_vfy.c +++ b/crypto/srp/srp_vfy.c @@ -270,13 +270,14 @@ SRP_VBASE *SRP_VBASE_new(char *seed_key) return vb; } -int SRP_VBASE_free(SRP_VBASE *vb) +void SRP_VBASE_free(SRP_VBASE *vb) { + if (!vb) + return; sk_SRP_user_pwd_pop_free(vb->users_pwd, SRP_user_pwd_free); sk_SRP_gN_cache_free(vb->gN_cache); OPENSSL_free(vb->seed_key); OPENSSL_free(vb); - return 0; } static SRP_gN_cache *SRP_gN_new_init(const char *ch) @@ -457,8 +458,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) SRP_user_pwd_free(user_pwd); - if (tmpdb) - TXT_DB_free(tmpdb); + TXT_DB_free(tmpdb); BIO_free_all(in); sk_SRP_gN_free(SRP_gN_tab); @@ -509,7 +509,8 @@ SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username) BN_bin2bn(digv, SHA_DIGEST_LENGTH, NULL))) return user; - err:SRP_user_pwd_free(user); + err: + SRP_user_pwd_free(user); return NULL; } diff --git a/crypto/x509v3/v3_ncons.c b/crypto/x509v3/v3_ncons.c index c66e08042d..1e6fae8081 100644 --- a/crypto/x509v3/v3_ncons.c +++ b/crypto/x509v3/v3_ncons.c @@ -149,10 +149,8 @@ static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, memerr: X509V3err(X509V3_F_V2I_NAME_CONSTRAINTS, ERR_R_MALLOC_FAILURE); err: - if (ncons) - NAME_CONSTRAINTS_free(ncons); - if (sub) - GENERAL_SUBTREE_free(sub); + NAME_CONSTRAINTS_free(ncons); + GENERAL_SUBTREE_free(sub); return NULL; } diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c index e70d5e927f..ecfc68dcb7 100644 --- a/crypto/x509v3/v3_scts.c +++ b/crypto/x509v3/v3_scts.c @@ -161,11 +161,11 @@ static void timestamp_print(BIO *out, SCT_TIMESTAMP timestamp) static void SCT_free(SCT *sct) { - if (sct) { - if (sct->sct) - OPENSSL_free(sct->sct); - OPENSSL_free(sct); - } + if (!sct) + return; + if (sct->sct) + OPENSSL_free(sct->sct); + OPENSSL_free(sct); } static void SCT_LIST_free(STACK_OF(SCT) *a) |