diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bio/bss_acpt.c | 2 | ||||
-rw-r--r-- | crypto/bio/bss_conn.c | 2 | ||||
-rw-r--r-- | crypto/bn/bn_blind.c | 2 | ||||
-rw-r--r-- | crypto/bn/bn_ctx.c | 2 | ||||
-rw-r--r-- | crypto/bn/bn_mont.c | 14 | ||||
-rw-r--r-- | crypto/bn/bn_recp.c | 6 | ||||
-rw-r--r-- | crypto/buffer/buffer.c | 2 | ||||
-rw-r--r-- | crypto/comp/comp_lib.c | 2 | ||||
-rw-r--r-- | crypto/err/err.c | 29 | ||||
-rw-r--r-- | crypto/txt_db/txt_db.c | 2 | ||||
-rw-r--r-- | crypto/x509/x509_lu.c | 2 |
11 files changed, 43 insertions, 22 deletions
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index 0171c49607..64cc452891 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -101,6 +101,8 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void) static void BIO_ACCEPT_free(BIO_ACCEPT *a) { + if (a == NULL) + return; OPENSSL_free(a->param_addr); OPENSSL_free(a->param_serv); BIO_ADDRINFO_free(a->addr_first); diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 0fad02fdd5..cc245ab07c 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -232,6 +232,8 @@ BIO_CONNECT *BIO_CONNECT_new(void) void BIO_CONNECT_free(BIO_CONNECT *a) { + if (a == NULL) + return; OPENSSL_free(a->param_hostname); OPENSSL_free(a->param_service); BIO_ADDRINFO_free(a->addr_first); diff --git a/crypto/bn/bn_blind.c b/crypto/bn/bn_blind.c index 8bd61567e7..985d3ef32b 100644 --- a/crypto/bn/bn_blind.c +++ b/crypto/bn/bn_blind.c @@ -80,6 +80,8 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) void BN_BLINDING_free(BN_BLINDING *r) { + if (r == NULL) + return; BN_free(r->A); BN_free(r->Ai); BN_free(r->e); diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c index 7202aef326..68c0468743 100644 --- a/crypto/bn/bn_ctx.c +++ b/crypto/bn/bn_ctx.c @@ -156,6 +156,8 @@ BN_CTX *BN_CTX_secure_new(void) void BN_CTX_free(BN_CTX *ctx) { + if (ctx == NULL) + return; #ifdef BN_CTX_DEBUG { BN_POOL_ITEM *pool = ctx->pool.head; diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c index bae7d235bd..c882891d5e 100644 --- a/crypto/bn/bn_mont.c +++ b/crypto/bn/bn_mont.c @@ -208,18 +208,20 @@ BN_MONT_CTX *BN_MONT_CTX_new(void) void BN_MONT_CTX_init(BN_MONT_CTX *ctx) { ctx->ri = 0; - bn_init(&(ctx->RR)); - bn_init(&(ctx->N)); - bn_init(&(ctx->Ni)); + bn_init(&ctx->RR); + bn_init(&ctx->N); + bn_init(&ctx->Ni); ctx->n0[0] = ctx->n0[1] = 0; ctx->flags = 0; } void BN_MONT_CTX_free(BN_MONT_CTX *mont) { - BN_clear_free(&(mont->RR)); - BN_clear_free(&(mont->N)); - BN_clear_free(&(mont->Ni)); + if (mont == NULL) + return; + BN_clear_free(&mont->RR); + BN_clear_free(&mont->N); + BN_clear_free(&mont->Ni); if (mont->flags & BN_FLG_MALLOCED) OPENSSL_free(mont); } diff --git a/crypto/bn/bn_recp.c b/crypto/bn/bn_recp.c index 923a9b33d8..8eb500b61a 100644 --- a/crypto/bn/bn_recp.c +++ b/crypto/bn/bn_recp.c @@ -32,8 +32,10 @@ BN_RECP_CTX *BN_RECP_CTX_new(void) void BN_RECP_CTX_free(BN_RECP_CTX *recp) { - BN_free(&(recp->N)); - BN_free(&(recp->Nr)); + if (recp == NULL) + return; + BN_free(&recp->N); + BN_free(&recp->Nr); if (recp->flags & BN_FLG_MALLOCED) OPENSSL_free(recp); } diff --git a/crypto/buffer/buffer.c b/crypto/buffer/buffer.c index dfa5c23d1d..48618a4435 100644 --- a/crypto/buffer/buffer.c +++ b/crypto/buffer/buffer.c @@ -42,6 +42,8 @@ BUF_MEM *BUF_MEM_new(void) void BUF_MEM_free(BUF_MEM *a) { + if (a == NULL) + return; if (a->data != NULL) { if (a->flags & BUF_MEM_FLAG_SECURE) OPENSSL_secure_clear_free(a->data, a->max); diff --git a/crypto/comp/comp_lib.c b/crypto/comp/comp_lib.c index 5bed1876a8..c199bb352f 100644 --- a/crypto/comp/comp_lib.c +++ b/crypto/comp/comp_lib.c @@ -45,6 +45,8 @@ const char *COMP_get_name(const COMP_METHOD *meth) void COMP_CTX_free(COMP_CTX *ctx) { + if (ctx == NULL) + return; if (ctx->meth->finish != NULL) ctx->meth->finish(ctx); diff --git a/crypto/err/err.c b/crypto/err/err.c index 4ae6178686..4c5f354e5c 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -233,29 +233,30 @@ static void build_SYS_str_reasons(void) } #endif -#define err_clear_data(p,i) \ +#define err_clear_data(p, i) \ do { \ - if ((p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ - { \ + if ((p)->err_data_flags[i] & ERR_TXT_MALLOCED) {\ OPENSSL_free((p)->err_data[i]); \ - (p)->err_data[i]=NULL; \ - } \ - (p)->err_data_flags[i]=0; \ - } while(0) + (p)->err_data[i] = NULL; \ + } \ + (p)->err_data_flags[i] = 0; \ + } while (0) -#define err_clear(p,i) \ +#define err_clear(p, i) \ do { \ - (p)->err_flags[i]=0; \ - (p)->err_buffer[i]=0; \ - err_clear_data(p,i); \ - (p)->err_file[i]=NULL; \ - (p)->err_line[i]= -1; \ - } while(0) + err_clear_data(p, i); \ + (p)->err_flags[i] = 0; \ + (p)->err_buffer[i] = 0; \ + (p)->err_file[i] = NULL; \ + (p)->err_line[i] = -1; \ + } while (0) static void ERR_STATE_free(ERR_STATE *s) { int i; + if (s == NULL) + return; for (i = 0; i < ERR_NUM_ERRORS; i++) { err_clear_data(s, i); } diff --git a/crypto/txt_db/txt_db.c b/crypto/txt_db/txt_db.c index a08f346af6..a00560dcbd 100644 --- a/crypto/txt_db/txt_db.c +++ b/crypto/txt_db/txt_db.c @@ -284,6 +284,8 @@ void TXT_DB_free(TXT_DB *db) int i, n; char **p, *max; + if (db == NULL) + return; if (db->index != NULL) { for (i = db->num_fields - 1; i >= 0; i--) lh_OPENSSL_STRING_free(db->index[i]); diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c index d69cedb72f..7b33ebad73 100644 --- a/crypto/x509/x509_lu.c +++ b/crypto/x509/x509_lu.c @@ -178,6 +178,8 @@ void X509_STORE_free(X509_STORE *vfy) STACK_OF(X509_LOOKUP) *sk; X509_LOOKUP *lu; + if (vfy == NULL) + return; CRYPTO_DOWN_REF(&vfy->references, &i, vfy->lock); REF_PRINT_COUNT("X509_STORE", vfy); if (i > 0) |