aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2015-02-18 10:39:49 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2015-02-18 10:39:49 +0000
commit4e41c99ed88505819574506a4d3b0b918f70dbf2 (patch)
tree61c82c0311487b336b8ee7af24ebc4e90b8a9765
parentcd4cd1dd2671f991888d9dde7d2d402f7051db64 (diff)
parentf7db5e0a4a8b1de5154e154ec2097ae867fd7380 (diff)
downloadmbedtls-archive/mbedtls-1.4.zip
mbedtls-archive/mbedtls-1.4.tar.gz
mbedtls-archive/mbedtls-1.4.tar.bz2
Merge branch 'development' into dtlsarchive/mbedtls-1.4
* development: Avoid possible dangling pointers Conflicts: library/ssl_tls.c
-rw-r--r--library/ssl_tls.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 052a198..b09ee53 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -4925,16 +4925,12 @@ int ssl_init( ssl_context *ssl )
/*
* Prepare base structures
*/
- ssl->in_buf = polarssl_malloc( len );
- ssl->out_buf = polarssl_malloc( len );
-
- if( ssl->in_buf == NULL || ssl->out_buf == NULL )
+ if( ( ssl->in_buf = polarssl_malloc( len ) ) == NULL ||
+ ( ssl->out_buf = polarssl_malloc( len ) ) == NULL )
{
SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", len ) );
polarssl_free( ssl->in_buf );
- polarssl_free( ssl->out_buf );
ssl->in_buf = NULL;
- ssl->out_buf = NULL;
return( POLARSSL_ERR_SSL_MALLOC_FAILED );
}