stm32/mbedtls: Add NULL pointer check in m_free_mbedtls.
According to the C standard the free(void *ptr) function: if ptr is a null pointer, no action occurs. Signed-off-by: Peter Züger <zueger.peter@icloud.com>
This commit is contained in:
committed by
Damien George
parent
a16dcc8136
commit
95ee29f4f4
@@ -62,6 +62,9 @@ void *m_calloc_mbedtls(size_t nmemb, size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void m_free_mbedtls(void *ptr_in) {
|
void m_free_mbedtls(void *ptr_in) {
|
||||||
|
if (ptr_in == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
void **ptr = &((void**)ptr_in)[-2];
|
void **ptr = &((void**)ptr_in)[-2];
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
uint32_t nb;
|
uint32_t nb;
|
||||||
|
|||||||
Reference in New Issue
Block a user