mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Replace malloc with calloc
- platform layer currently broken (not adapted yet) - memmory_buffer_alloc too
This commit is contained in:
@ -53,7 +53,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#define mbedtls_free free
|
||||
#define mbedtls_malloc malloc
|
||||
#define mbedtls_calloc calloc
|
||||
#define mbedtls_snprintf snprintf
|
||||
#endif
|
||||
|
||||
@ -238,7 +238,7 @@ static int x509_get_entries( unsigned char **p,
|
||||
|
||||
if( *p < end )
|
||||
{
|
||||
cur_entry->next = mbedtls_malloc( sizeof( mbedtls_x509_crl_entry ) );
|
||||
cur_entry->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_crl_entry ) );
|
||||
|
||||
if( cur_entry->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
@ -281,7 +281,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
|
||||
|
||||
if( crl->version != 0 && crl->next == NULL )
|
||||
{
|
||||
crl->next = mbedtls_malloc( sizeof( mbedtls_x509_crl ) );
|
||||
crl->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_crl ) );
|
||||
|
||||
if( crl->next == NULL )
|
||||
{
|
||||
@ -296,7 +296,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
|
||||
/*
|
||||
* Copy raw DER-encoded CRL
|
||||
*/
|
||||
if( ( p = mbedtls_malloc( buflen ) ) == NULL )
|
||||
if( ( p = mbedtls_calloc( 1, buflen ) ) == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, buflen );
|
||||
|
Reference in New Issue
Block a user