Remove a few redundant memset after calloc.
Using the following semantic patch provided by Mansour Moufid: @@ expression x; @@ x = mbedtls_calloc(...) ... - memset(x, 0, ...);
This commit is contained in:
parent
b2a18a2a98
commit
1b8de57827
8 changed files with 1 additions and 17 deletions
|
@ -66,6 +66,7 @@ API Changes
|
|||
* Signature of mpi_mul_mpi() changed to make the last argument unsigned
|
||||
* calloc() is now used instead of malloc() everywhere. API of platform
|
||||
layer and the memory_buffer_alloc module changed accordingly.
|
||||
(Thanks to Mansour Moufid for helping with the replacement.)
|
||||
* Change SSL_DISABLE_RENEGOTIATION config.h flag to SSL_RENEGOTIATION
|
||||
(support for renegotiation now needs explicit enabling in config.h).
|
||||
* net_connect() and net_bind() have a new 'proto' argument to choose
|
||||
|
|
|
@ -275,8 +275,6 @@ int mbedtls_asn1_get_sequence_of( unsigned char **p,
|
|||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_ASN1_MALLOC_FAILED );
|
||||
|
||||
memset( cur->next, 0, sizeof( mbedtls_asn1_sequence ) );
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -316,8 +316,6 @@ mbedtls_asn1_named_data *mbedtls_asn1_store_named_data( mbedtls_asn1_named_data
|
|||
if( ( cur = mbedtls_calloc( 1, sizeof(mbedtls_asn1_named_data) ) ) == NULL )
|
||||
return( NULL );
|
||||
|
||||
memset( cur, 0, sizeof(mbedtls_asn1_named_data) );
|
||||
|
||||
cur->oid.len = oid_len;
|
||||
cur->oid.p = mbedtls_calloc( 1, oid_len );
|
||||
if( cur->oid.p == NULL )
|
||||
|
|
|
@ -229,8 +229,6 @@ int mbedtls_ssl_cache_set( void *data, const mbedtls_ssl_session *session )
|
|||
goto exit;
|
||||
}
|
||||
|
||||
memset( cur, 0, sizeof(mbedtls_ssl_cache_entry) );
|
||||
|
||||
if( prv == NULL )
|
||||
cache->chain = cur;
|
||||
else
|
||||
|
|
|
@ -2931,8 +2931,6 @@ static int ssl_reassemble_dtls_handshake( mbedtls_ssl_context *ssl )
|
|||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
|
||||
memset( ssl->handshake->hs_msg, 0, alloc_len );
|
||||
|
||||
/* Prepare final header: copy msg_type, length and message_seq,
|
||||
* then add standardised fragment_offset and fragment_length */
|
||||
memcpy( ssl->handshake->hs_msg, ssl->in_msg, 6 );
|
||||
|
@ -5011,9 +5009,6 @@ int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
|
|||
return( MBEDTLS_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
|
||||
memset( ssl-> in_buf, 0, len );
|
||||
memset( ssl->out_buf, 0, len );
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if( conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
|
||||
{
|
||||
|
|
|
@ -457,8 +457,6 @@ int mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,
|
|||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
|
||||
memset( cur->next, 0, sizeof( mbedtls_x509_name ) );
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
|
@ -473,8 +471,6 @@ int mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,
|
|||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
|
||||
memset( cur->next, 0, sizeof( mbedtls_x509_name ) );
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,7 +243,6 @@ static int x509_get_entries( unsigned char **p,
|
|||
if( cur_entry->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
|
||||
memset( cur_entry->next, 0, sizeof( mbedtls_x509_crl_entry ) );
|
||||
cur_entry = cur_entry->next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -365,7 +365,6 @@ static int x509_get_subject_alt_name( unsigned char **p,
|
|||
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
|
||||
MBEDTLS_ERR_ASN1_MALLOC_FAILED );
|
||||
|
||||
memset( cur->next, 0, sizeof( mbedtls_asn1_sequence ) );
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue