Make malloc-init script a bit happier

This commit is contained in:
Manuel Pégourié-Gonnard 2014-11-12 22:27:42 +01:00
parent 5924f9f810
commit e5b0fc1847
5 changed files with 15 additions and 18 deletions

View file

@ -105,10 +105,8 @@ int ssl_cache_get( void *data, ssl_session *session )
*/
if( entry->peer_cert.p != NULL )
{
session->peer_cert =
(x509_crt *) polarssl_malloc( sizeof(x509_crt) );
if( session->peer_cert == NULL )
if( ( session->peer_cert = (x509_crt *) polarssl_malloc(
sizeof(x509_crt) ) ) == NULL )
{
ret = 1;
goto exit;
@ -226,8 +224,7 @@ int ssl_cache_set( void *data, const ssl_session *session )
/*
* max_entries not reached, create new entry
*/
cur = (ssl_cache_entry *)
polarssl_malloc( sizeof(ssl_cache_entry) );
cur = (ssl_cache_entry *) polarssl_malloc( sizeof(ssl_cache_entry) );
if( cur == NULL )
{
ret = 1;
@ -264,8 +261,8 @@ int ssl_cache_set( void *data, const ssl_session *session )
*/
if( session->peer_cert != NULL )
{
cur->peer_cert.p = (unsigned char *)
polarssl_malloc( session->peer_cert->raw.len );
cur->peer_cert.p = (unsigned char *) polarssl_malloc(
session->peer_cert->raw.len );
if( cur->peer_cert.p == NULL )
{
ret = 1;