Replace malloc with calloc
- platform layer currently broken (not adapted yet)
- memmory_buffer_alloc too
diff --git a/library/x509.c b/library/x509.c
index a3e288b..3cddc5f 100644
--- a/library/x509.c
+++ b/library/x509.c
@@ -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 @@
/* 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 @@
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 @@
{
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 );