Merge branch 'development' into dtls

* development:
  Avoid possible dangling pointers

Conflicts:
	library/ssl_tls.c
This commit is contained in:
Manuel Pégourié-Gonnard 2015-02-18 10:39:49 +00:00
commit 4e41c99ed8

View File

@ -4925,16 +4925,12 @@ int ssl_init( ssl_context *ssl )
/* /*
* Prepare base structures * Prepare base structures
*/ */
ssl->in_buf = polarssl_malloc( len ); if( ( ssl->in_buf = polarssl_malloc( len ) ) == NULL ||
ssl->out_buf = polarssl_malloc( len ); ( ssl->out_buf = polarssl_malloc( len ) ) == NULL )
if( ssl->in_buf == NULL || ssl->out_buf == NULL )
{ {
SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", len ) ); SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", len ) );
polarssl_free( ssl->in_buf ); polarssl_free( ssl->in_buf );
polarssl_free( ssl->out_buf );
ssl->in_buf = NULL; ssl->in_buf = NULL;
ssl->out_buf = NULL;
return( POLARSSL_ERR_SSL_MALLOC_FAILED ); return( POLARSSL_ERR_SSL_MALLOC_FAILED );
} }