--- openssl-1.0.2a/ssl/s3_pkt.c	2015-03-19 15:30:36.000000000 +0200
+++ openssl-1.0.2a/ssl/s3_pkt_new.c	2015-05-23 16:45:24.896828800 +0300
@@ -869,6 +869,11 @@
         if (i <= 0)
             return (i);
         /* if it went, fall through and send more stuff */
+        /* we may have released our buffer, so get it again */
+       if (wb->buf == NULL)
+            if (!ssl3_setup_write_buffer(s))
+                          return -1;
+
     }
 
     if (wb->buf == NULL)
