mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
Replace malloc with calloc
- platform layer currently broken (not adapted yet) - memmory_buffer_alloc too
This commit is contained in:
parent
065122cfe9
commit
7551cb9ee9
31 changed files with 122 additions and 131 deletions
|
|
@ -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 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue