Replace malloc with calloc
- platform layer currently broken (not adapted yet) - memmory_buffer_alloc too
This commit is contained in:
parent
065122cfe9
commit
7551cb9ee9
31 changed files with 122 additions and 131 deletions
library
|
@ -55,7 +55,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define mbedtls_free free
|
||||
#define mbedtls_malloc malloc
|
||||
#define mbedtls_calloc calloc
|
||||
#define mbedtls_printf printf
|
||||
#define mbedtls_snprintf snprintf
|
||||
#endif
|
||||
|
@ -452,7 +452,7 @@ int mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,
|
|||
/* Mark this item as being no the only one in a set */
|
||||
cur->next_merged = 1;
|
||||
|
||||
cur->next = mbedtls_malloc( sizeof( mbedtls_x509_name ) );
|
||||
cur->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_name ) );
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
|
@ -468,7 +468,7 @@ int mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,
|
|||
if( *p == end )
|
||||
return( 0 );
|
||||
|
||||
cur->next = mbedtls_malloc( sizeof( mbedtls_x509_name ) );
|
||||
cur->next = mbedtls_calloc( 1, sizeof( mbedtls_x509_name ) );
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
|
@ -597,7 +597,7 @@ int mbedtls_x509_get_sig_alg( const mbedtls_x509_buf *sig_oid, const mbedtls_x50
|
|||
{
|
||||
mbedtls_pk_rsassa_pss_options *pss_opts;
|
||||
|
||||
pss_opts = mbedtls_malloc( sizeof( mbedtls_pk_rsassa_pss_options ) );
|
||||
pss_opts = mbedtls_calloc( 1, sizeof( mbedtls_pk_rsassa_pss_options ) );
|
||||
if( pss_opts == NULL )
|
||||
return( MBEDTLS_ERR_X509_MALLOC_FAILED );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue