ssl_init() left a dirty in_ctr pointer on failed allocation of out_ctr
diff --git a/ChangeLog b/ChangeLog
index aef4d6a..e7e2a71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,8 @@
    * Fixed CMake symlinking on out-of-source builds
    * Bignum's MIPS-32 assembly was used on MIPS-64, causing chaos. (Found by
      Alex Wilson.)
+   * ssl_init() was leaving a dirty pointer in ssl_context if malloc of
+     out_ctr failed
 
 = Version 1.2.10 released 2013-10-07
 Changes
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index c42eccc..4704b44 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -3051,6 +3051,7 @@
     {
         SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", len ) );
         free( ssl-> in_ctr );
+        ssl->in_ctr = NULL;
         return( POLARSSL_ERR_SSL_MALLOC_FAILED );
     }