1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Replace malloc with calloc

- platform layer currently broken (not adapted yet)
- memmory_buffer_alloc too
This commit is contained in:
Manuel Pégourié-Gonnard
2015-05-26 16:04:06 +02:00
parent 065122cfe9
commit 7551cb9ee9
31 changed files with 122 additions and 131 deletions

View File

@ -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 @@ static int load_file( const char *path, unsigned char **buf, size_t *n )
*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 );