diff -u -p a/ssl/ssl_task.c b/ssl/ssl_task.c
--- a/ssl/ssl_task.c 2008-12-16 14:41:00.000000000 +0100
+++ b/ssl/ssl_task.c 2009-03-19 13:51:36.000000000 +0100
@@ -358,8 +358,11 @@
 	 * BIO structure and SSL_set_bio() and SSL_free() automatically
 	 * BIO_free non NULL entries.
 	 * You should not normally do this or be required to do this */
-	s_ssl->rbio=NULL;
-	s_ssl->wbio=NULL;
+	if (s_ssl != NULL) {
+        s_ssl->rbio=NULL;
+	     s_ssl->wbio=NULL;
+   }
 
 	if (c_to_s != NULL) BIO_free(c_to_s);
 	if (s_to_c != NULL) BIO_free(s_to_c);
