mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2024-12-29 09:21:19 +00:00
Add header guard around malloc(0) returning NULL implementation
Make it safe to import the config multiple times without having multiple definition errors. (This prevents errors in the fuzzers in a later patch.) Signed-off-by: Daniel Axtens <dja@axtens.net>
This commit is contained in:
parent
052deb941f
commit
09e34b78ee
@ -21,6 +21,8 @@
|
||||
#include "mbedtls/mbedtls_config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef MBEDTLS_PLATFORM_STD_CALLOC
|
||||
static inline void *custom_calloc( size_t nmemb, size_t size )
|
||||
{
|
||||
if( nmemb == 0 || size == 0 )
|
||||
@ -30,3 +32,4 @@ static inline void *custom_calloc( size_t nmemb, size_t size )
|
||||
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user