mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 00:55:39 +01:00
Fixes memory leak in memory_buffer_alloc.c debug
Debug symbols were being leaked in memory_buffer_alloc.c
This commit is contained in:
parent
45732c7cac
commit
4225611887
@ -417,6 +417,12 @@ static void buffer_alloc_free( void *ptr )
|
||||
heap.total_used -= hdr->size;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BACKTRACE)
|
||||
free( hdr->trace );
|
||||
hdr->trace = NULL;
|
||||
hdr->trace_count = 0;
|
||||
#endif
|
||||
|
||||
// Regroup with block before
|
||||
//
|
||||
if( hdr->prev != NULL && hdr->prev->alloc == 0 )
|
||||
@ -432,9 +438,6 @@ static void buffer_alloc_free( void *ptr )
|
||||
if( hdr->next != NULL )
|
||||
hdr->next->prev = hdr;
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BACKTRACE)
|
||||
free( old->trace );
|
||||
#endif
|
||||
memset( old, 0, sizeof(memory_header) );
|
||||
}
|
||||
|
||||
@ -474,9 +477,6 @@ static void buffer_alloc_free( void *ptr )
|
||||
if( hdr->next != NULL )
|
||||
hdr->next->prev = hdr;
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BACKTRACE)
|
||||
free( old->trace );
|
||||
#endif
|
||||
memset( old, 0, sizeof(memory_header) );
|
||||
}
|
||||
|
||||
@ -491,11 +491,6 @@ static void buffer_alloc_free( void *ptr )
|
||||
heap.first_free = hdr;
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BACKTRACE)
|
||||
hdr->trace = NULL;
|
||||
hdr->trace_count = 0;
|
||||
#endif
|
||||
|
||||
if( ( heap.verify & MBEDTLS_MEMORY_VERIFY_FREE ) && verify_chain() != 0 )
|
||||
mbedtls_exit( 1 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user