* include/aout_internal.h: fixed old memory leak when alloca() isn't available.

This commit is contained in:
Gildas Bazin 2005-01-07 09:54:01 +00:00
parent 2b2441ca8b
commit d4164c2332

View File

@ -39,6 +39,7 @@ typedef struct aout_alloc_t
if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_STACK ) \
{ \
(p_new_buffer) = alloca( i_alloc_size + sizeof(aout_buffer_t) );\
i_alloc_type = AOUT_ALLOC_STACK; \
} \
else
#else
@ -53,16 +54,17 @@ typedef struct aout_alloc_t
} \
else \
{ \
int i_alloc_size; \
int i_alloc_size, i_alloc_type; \
i_alloc_size = (int)( (uint64_t)(p_alloc)->i_bytes_per_sec \
* (i_nb_usec) / 1000000 + 1 ); \
ALLOCA_TEST( p_alloc, p_new_buffer ) \
{ \
(p_new_buffer) = malloc( i_alloc_size + sizeof(aout_buffer_t) );\
i_alloc_type = AOUT_ALLOC_HEAP; \
} \
if ( p_new_buffer != NULL ) \
{ \
(p_new_buffer)->i_alloc_type = (p_alloc)->i_alloc_type; \
(p_new_buffer)->i_alloc_type = i_alloc_type; \
(p_new_buffer)->i_size = i_alloc_size; \
(p_new_buffer)->p_buffer = (byte_t *)(p_new_buffer) \
+ sizeof(aout_buffer_t); \