Moved a lot of spandsp to the use of custom allocation functions

This commit is contained in:
Steve Underwood committed 2013-08-06 00:49:15 +08:00
1 parent 7c744ce1d8
commit d5e4089c22
46 files changed
+233 -187

No files matched your search

+9 -8
View File
@@ -47,6 +47,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/dc_restore.h"
#include "spandsp/modem_echo.h"
@@ -66,29 +67,29 @@ SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_init(int len)
{
modem_echo_can_state_t *ec;
if ((ec = (modem_echo_can_state_t *) malloc(sizeof(*ec))) == NULL)
if ((ec = (modem_echo_can_state_t *) span_alloc(sizeof(*ec))) == NULL)
return NULL;
memset(ec, 0, sizeof(*ec));
ec->taps = len;
ec->curr_pos = ec->taps - 1;
if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL)
if ((ec->fir_taps32 = (int32_t *) span_alloc(ec->taps*sizeof(int32_t))) == NULL)
{
free(ec);
return NULL;
}
memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t));
if ((ec->fir_taps16 = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL)
if ((ec->fir_taps16 = (int16_t *) span_alloc(ec->taps*sizeof(int16_t))) == NULL)
{
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
memset(ec->fir_taps16, 0, ec->taps*sizeof(int16_t));
if (fir16_create(&ec->fir_state, ec->fir_taps16, ec->taps) == NULL)
{
free(ec->fir_taps16);
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps16);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
return ec;