Handle the unlikely event that BIO_get_mem_data() returns -ve.
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
index 5cea73c..af97a7e 100644
--- a/ssl/s3_clnt.c
+++ b/ssl/s3_clnt.c
@@ -871,7 +871,8 @@
 			}
 		}
 	s->s3->tmp.new_cipher=c;
-	ssl3_digest_cached_records(s);
+	if (!ssl3_digest_cached_records(s))
+		goto f_err;
 
 	/* lets get the compression algorithm */
 	/* COMPRESSION */