1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +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

@ -4,7 +4,7 @@
#include <stdio.h>
#define mbedtls_printf printf
#define mbedtls_fprintf fprintf
#define mbedtls_malloc malloc
#define mbedtls_calloc calloc
#define mbedtls_free free
#define mbedtls_exit exit
#define mbedtls_fprintf fprintf
@ -123,7 +123,7 @@ static unsigned char *zero_alloc( size_t len )
void *p;
size_t actual_len = ( len != 0 ) ? len : 1;
p = mbedtls_malloc( actual_len );
p = mbedtls_calloc( 1, actual_len );
assert( p != NULL );
memset( p, 0x00, actual_len );
@ -150,7 +150,7 @@ static unsigned char *unhexify_alloc( const char *ibuf, size_t *olen )
if( *olen == 0 )
return( zero_alloc( *olen ) );
obuf = mbedtls_malloc( *olen );
obuf = mbedtls_calloc( 1, *olen );
assert( obuf != NULL );
(void) unhexify( obuf, ibuf );