Accept NULL in *_free.
diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c
index 51f6861..097c35e 100644
--- a/ssl/s2_lib.c
+++ b/ssl/s2_lib.c
@@ -257,6 +257,9 @@
 	{
 	SSL2_CTX *s2;
 
+	if(s == NULL)
+	    return;
+
 	s2=s->s2;
 	if (s2->rbuf != NULL) Free(s2->rbuf);
 	if (s2->wbuf != NULL) Free(s2->wbuf);
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c
index 116b096..ea8e39e 100644
--- a/ssl/s3_enc.c
+++ b/ssl/s3_enc.c
@@ -208,6 +208,7 @@
 
 	p=s->s3->tmp.key_block;
 	i=EVP_MD_size(m);
+	// Should be 	j=exp?min(5,EVP_CIPHER_key_length(c)):EVP_CIPHER_key_length(c); ?? - Ben 30/12/98
 	j=(exp)?5:EVP_CIPHER_key_length(c);
 	k=EVP_CIPHER_iv_length(c);
 	if (	(which == SSL3_CHANGE_CIPHER_CLIENT_WRITE) ||
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index a523207..f15bb24 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -456,6 +456,9 @@
 void ssl3_free(s)
 SSL *s;
 	{
+	if(s == NULL)
+	    return;
+
 	ssl3_cleanup_key_block(s);
 	if (s->s3->rbuf.buf != NULL)
 		Free(s->s3->rbuf.buf);
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index 1bff91e..7d4531d 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -105,6 +105,9 @@
 	{
 	int i;
 
+	if(c == NULL)
+	    return;
+
 	i=CRYPTO_add(&c->references,-1,CRYPTO_LOCK_SSL_CERT);
 #ifdef REF_PRINT
 	REF_PRINT("CERT",c);
diff --git a/ssl/ssl_comp.c b/ssl/ssl_comp.c
index 7724ff5..1593afb 100644
--- a/ssl/ssl_comp.c
+++ b/ssl/ssl_comp.c
@@ -361,6 +361,9 @@
 	{
 	int i;
 
+	if(ss == NULL)
+	    return;
+
 	i=CRYPTO_add(&ss->references,-1,CRYPTO_LOCK_SSL_SESSION);
 #ifdef REF_PRINT
 	REF_PRINT("SSL_SESSION",ss);
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index e562330..9e578fd 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -203,6 +203,9 @@
 	{
 	int i;
 
+	if(s == NULL)
+	    return;
+
 	i=CRYPTO_add(&s->references,-1,CRYPTO_LOCK_SSL);
 #ifdef REF_PRINT
 	REF_PRINT("SSL",s);
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index d4978a7..95cd7fe 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -363,6 +363,9 @@
 	{
 	int i;
 
+	if(ss == NULL)
+	    return;
+
 	i=CRYPTO_add(&ss->references,-1,CRYPTO_LOCK_SSL_SESSION);
 #ifdef REF_PRINT
 	REF_PRINT("SSL_SESSION",ss);