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