Replace malloc with calloc
- platform layer currently broken (not adapted yet)
- memmory_buffer_alloc too
diff --git a/library/asn1parse.c b/library/asn1parse.c
index a399a7f..ae392bb 100644
--- a/library/asn1parse.c
+++ b/library/asn1parse.c
@@ -40,7 +40,7 @@
#include "mbedtls/platform.h"
#else
#include <stdlib.h>
-#define mbedtls_malloc malloc
+#define mbedtls_calloc calloc
#define mbedtls_free free
#endif
@@ -270,7 +270,7 @@
/* Allocate and assign next pointer */
if( *p < end )
{
- cur->next = mbedtls_malloc( sizeof( mbedtls_asn1_sequence ) );
+ cur->next = mbedtls_calloc( 1, sizeof( mbedtls_asn1_sequence ) );
if( cur->next == NULL )
return( MBEDTLS_ERR_ASN1_MALLOC_FAILED );