summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>1999-01-07 19:15:59 +0000
committerBen Laurie <ben@openssl.org>1999-01-07 19:15:59 +0000
commite03ddfae7ea7c27193d3f7c0eaa1d01704647d77 (patch)
tree7cf2e8444b222a3a52c4735e0415916bb81c4494 /crypto
parent6fa89f94c4452be54577eb071891d77c9e2abe16 (diff)
Accept NULL in *_free.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/p7_lib.c3
-rw-r--r--crypto/asn1/x_name.c3
-rw-r--r--crypto/bio/b_sock.c3
-rw-r--r--crypto/bio/bss_acpt.c3
-rw-r--r--crypto/bio/bss_conn.c3
-rw-r--r--crypto/bn/bn_blind.c3
-rw-r--r--crypto/bn/bn_lib.c3
-rw-r--r--crypto/bn/bn_mont.c3
-rw-r--r--crypto/bn/bn_recp.c3
-rw-r--r--crypto/buffer/buffer.c3
-rw-r--r--crypto/comp/comp_lib.c3
-rw-r--r--crypto/err/err.c3
-rw-r--r--crypto/rsa/rsa_eay.c3
-rw-r--r--crypto/rsa/rsa_enc.c3
-rw-r--r--crypto/txt_db/txt_db.c3
-rw-r--r--crypto/x509/x509_lu.c3
16 files changed, 44 insertions, 4 deletions
diff --git a/crypto/asn1/p7_lib.c b/crypto/asn1/p7_lib.c
index 06e1da4a74..4ab64777b3 100644
--- a/crypto/asn1/p7_lib.c
+++ b/crypto/asn1/p7_lib.c
@@ -267,6 +267,9 @@ PKCS7 *a;
void PKCS7_content_free(a)
PKCS7 *a;
{
+ if(a == NULL)
+ return;
+
if (a->asn1 != NULL) Free((char *)a->asn1);
if (a->d.ptr != NULL)
diff --git a/crypto/asn1/x_name.c b/crypto/asn1/x_name.c
index 3b8bc5191f..3af14c8e6c 100644
--- a/crypto/asn1/x_name.c
+++ b/crypto/asn1/x_name.c
@@ -263,6 +263,9 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_new()
void X509_NAME_free(a)
X509_NAME *a;
{
+ if(a == NULL)
+ return;
+
BUF_MEM_free(a->bytes);
sk_pop_free(a->entries,X509_NAME_ENTRY_free);
Free((char *)a);
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index 2c36150b9b..402439cc2e 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -310,6 +310,9 @@ struct hostent *a;
{
int i;
+ if(a == NULL)
+ return;
+
if (a->h_aliases != NULL)
{
for (i=0; a->h_aliases[i] != NULL; i++)
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c
index 872807d863..ecdd1709d1 100644
--- a/crypto/bio/bss_acpt.c
+++ b/crypto/bio/bss_acpt.c
@@ -173,6 +173,9 @@ BIO_ACCEPT *BIO_ACCEPT_new()
void BIO_ACCEPT_free(a)
BIO_ACCEPT *a;
{
+ if(a == NULL)
+ return;
+
if (a->param_addr != NULL) Free(a->param_addr);
if (a->addr != NULL) Free(a->addr);
if (a->bio_chain != NULL) BIO_free(a->bio_chain);
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c
index 3ec1388f2e..b90fea1a3a 100644
--- a/crypto/bio/bss_conn.c
+++ b/crypto/bio/bss_conn.c
@@ -357,6 +357,9 @@ BIO_CONNECT *BIO_CONNECT_new()
void BIO_CONNECT_free(a)
BIO_CONNECT *a;
{
+ if(a == NULL)
+ return;
+
if (a->param_hostname != NULL)
Free(a->param_hostname);
if (a->param_port != NULL)
diff --git a/crypto/bn/bn_blind.c b/crypto/bn/bn_blind.c
index 35be32b99a..c247f71c8a 100644
--- a/crypto/bn/bn_blind.c
+++ b/crypto/bn/bn_blind.c
@@ -90,6 +90,9 @@ err:
void BN_BLINDING_free(r)
BN_BLINDING *r;
{
+ if(r == NULL)
+ return;
+
if (r->A != NULL) BN_free(r->A );
if (r->Ai != NULL) BN_free(r->Ai);
Free(r);
diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c
index c027d0b03e..d8d2c3297d 100644
--- a/crypto/bn/bn_lib.c
+++ b/crypto/bn/bn_lib.c
@@ -341,6 +341,9 @@ BN_CTX *c;
{
int i;
+ if(c == NULL)
+ return;
+
for (i=0; i<BN_CTX_NUM; i++)
BN_clear_free(&(c->bn[i]));
if (c->flags & BN_FLG_MALLOCED)
diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c
index a5640b5a3b..2215dc3589 100644
--- a/crypto/bn/bn_mont.c
+++ b/crypto/bn/bn_mont.c
@@ -289,6 +289,9 @@ BN_MONT_CTX *ctx;
void BN_MONT_CTX_free(mont)
BN_MONT_CTX *mont;
{
+ if(mont == NULL)
+ return;
+
BN_free(&(mont->RR));
BN_free(&(mont->N));
BN_free(&(mont->Ni));
diff --git a/crypto/bn/bn_recp.c b/crypto/bn/bn_recp.c
index 97ca857ed1..3ace566b55 100644
--- a/crypto/bn/bn_recp.c
+++ b/crypto/bn/bn_recp.c
@@ -84,6 +84,9 @@ BN_RECP_CTX *BN_RECP_CTX_new()
void BN_RECP_CTX_free(recp)
BN_RECP_CTX *recp;
{
+ if(recp == NULL)
+ return;
+
BN_free(&(recp->N));
BN_free(&(recp->Nr));
if (recp->flags & BN_FLG_MALLOCED)
diff --git a/crypto/buffer/buffer.c b/crypto/buffer/buffer.c
index 7e8af9e2fa..b160a74a47 100644
--- a/crypto/buffer/buffer.c
+++ b/crypto/buffer/buffer.c
@@ -79,6 +79,9 @@ BUF_MEM *BUF_MEM_new()
void BUF_MEM_free(a)
BUF_MEM *a;
{
+ if(a == NULL)
+ return;
+
if (a->data != NULL)
{
memset(a->data,0,(unsigned int)a->max);
diff --git a/crypto/comp/comp_lib.c b/crypto/comp/comp_lib.c
index 8ce06951af..dcacb5557d 100644
--- a/crypto/comp/comp_lib.c
+++ b/crypto/comp/comp_lib.c
@@ -33,6 +33,9 @@ COMP_CTX *ctx;
{
/* CRYPTO_free_ex_data(rsa_meth,(char *)ctx,&ctx->ex_data); */
+ 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 5cf621855a..39c997aef8 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -175,6 +175,9 @@ 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/rsa/rsa_eay.c b/crypto/rsa/rsa_eay.c
index ec143e873b..b4050506c3 100644
--- a/crypto/rsa/rsa_eay.c
+++ b/crypto/rsa/rsa_eay.c
@@ -474,8 +474,7 @@ RSA *rsa;
err:
BN_clear_free(&m1);
BN_clear_free(&r1);
- if(ctx)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
return(ret);
}
diff --git a/crypto/rsa/rsa_enc.c b/crypto/rsa/rsa_enc.c
index 5f91239da5..c4a4ad5a60 100644
--- a/crypto/rsa/rsa_enc.c
+++ b/crypto/rsa/rsa_enc.c
@@ -531,8 +531,7 @@ RSA *rsa;
err:
if (m1 != NULL) BN_free(m1);
if (r1 != NULL) BN_free(r1);
- if(ctx != NULL)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
return(ret);
}
diff --git a/crypto/txt_db/txt_db.c b/crypto/txt_db/txt_db.c
index e4259d9768..dccb2b9513 100644
--- a/crypto/txt_db/txt_db.c
+++ b/crypto/txt_db/txt_db.c
@@ -356,6 +356,9 @@ 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--)
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index deec5adae5..8ea68198fc 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -259,6 +259,9 @@ X509_STORE *vfy;
STACK *sk;
X509_LOOKUP *lu;
+ if(vfy == NULL)
+ return;
+
sk=vfy->get_cert_methods;
for (i=0; i<sk_num(sk); i++)
{