Replace malloc with calloc
- platform layer currently broken (not adapted yet)
- memmory_buffer_alloc too
diff --git a/library/dhm.c b/library/dhm.c
index f09592a..af70885 100644
--- a/library/dhm.c
+++ b/library/dhm.c
@@ -51,7 +51,7 @@
#include <stdlib.h>
#include <stdio.h>
#define mbedtls_printf printf
-#define mbedtls_malloc malloc
+#define mbedtls_calloc calloc
#define mbedtls_free free
#endif
@@ -531,7 +531,7 @@
*n = (size_t) size;
if( *n + 1 == 0 ||
- ( *buf = mbedtls_malloc( *n + 1 ) ) == NULL )
+ ( *buf = mbedtls_calloc( 1, *n + 1 ) ) == NULL )
{
fclose( f );
return( MBEDTLS_ERR_DHM_MALLOC_FAILED );