#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
{
if (s == NULL)
{
- if ((s = (ademco_contactid_receiver_state_t *) malloc(sizeof (*s))) == NULL)
+ if ((s = (ademco_contactid_receiver_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) ademco_contactid_receiver_free(ademco_contactid_receiver_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (ademco_contactid_sender_state_t *) malloc(sizeof (*s))) == NULL)
+ if ((s = (ademco_contactid_sender_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) ademco_contactid_sender_free(ademco_contactid_sender_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
{
if (s == NULL)
{
- if ((s = (adsi_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (adsi_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (adsi_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (adsi_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) adsi_tx_free(adsi_tx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
-#if defined(HAVE_POSIX_MEMALIGN)
-static void *fake_posix_memalign(size_t alignment, size_t size);
-#endif
-static void *fake_aligned_alloc(size_t alignment, size_t size);
-
span_alloc_t __span_alloc = malloc;
#if defined(HAVE_ALIGNED_ALLOC)
span_aligned_alloc_t __span_aligned_alloc = aligned_alloc;
span_aligned_alloc_t __span_aligned_alloc = memalign;
#elif defined(HAVE_POSIX_MEMALIGN)
span_aligned_alloc_t __span_aligned_alloc = fake_posix_memalign;
+static void *fake_posix_memalign(size_t alignment, size_t size);
#else
span_aligned_alloc_t __span_aligned_alloc = fake_aligned_alloc;
#endif
span_realloc_t __span_realloc = realloc;
span_free_t __span_free = free;
-#if defined(HAVE_POSIX_MEMALIGN)
+static void *fake_aligned_alloc(size_t alignment, size_t size);
+
+#if defined(HAVE_ALIGNED_ALLOC)
+#elif defined(HAVE_MEMALIGN)
+#elif defined(HAVE_POSIX_MEMALIGN)
static void *fake_posix_memalign(size_t alignment, size_t size)
{
void *ptr;
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/async.h"
{
if (s == NULL)
{
- if ((s = (async_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (async_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->data_bits = data_bits;
SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (async_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (async_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/* We have a use_v14 parameter for completeness, but right now V.14 only
SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/power_meter.h"
for (call_id = s->call_id; call_id; call_id = next)
{
next = call_id->next;
- free(call_id);
+ span_free(call_id);
}
s->call_id = NULL;
s->rings_indicated = 0;
at_call_id_t *new_call_id;
at_call_id_t *call_id;
- /* TODO: We should really not merely ignore a failure to malloc */
- if ((new_call_id = (at_call_id_t *) malloc(sizeof(*new_call_id))) == NULL)
+ /* TODO: We should really not merely ignore a failure to allocate */
+ if ((new_call_id = (at_call_id_t *) span_alloc(sizeof(*new_call_id))) == NULL)
return;
call_id = s->call_id;
/* If these strdups fail its pretty harmless. We just appear to not
default:
/* Set value */
if (*target)
- free(*target);
+ span_free(*target);
/* If this strdup fails, it should be harmless */
*target = strdup(*t);
break;
{
if (s == NULL)
{
- if ((s = (at_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (at_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, '\0', sizeof(*s));
{
at_reset_call_info(s);
if (s->local_id)
- free(s->local_id);
+ span_free(s->local_id);
return 0;
}
/*- End of function --------------------------------------------------------*/
int ret;
ret = at_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/awgn.h"
if (s == NULL)
{
- if ((s = (awgn_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (awgn_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
if (idum < 0)
SPAN_DECLARE(int) awgn_free(awgn_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
{
if (s == NULL)
{
- if ((s = (bell_mf_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (bell_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
if (s == NULL)
{
- if ((s = (r2_mf_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (r2_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
if (s == NULL)
{
- if ((s = (bell_mf_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (bell_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
if (s == NULL)
{
- if ((s = (r2_mf_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (r2_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <time.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/bert.h"
if (s == NULL)
{
- if ((s = (bert_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (bert_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) bert_free(bert_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/bitstream.h"
#include "spandsp/private/bitstream.h"
{
if (s == NULL)
{
- if ((s = (bitstream_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (bitstream_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->bitstream = 0;
SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <inttypes.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/complex_filters.h"
int i;
filter_t *fi;
- if ((fi = (filter_t *) malloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
+ if ((fi = (filter_t *) span_alloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
{
fi->fs = fs;
fi->sum = 0.0;
SPAN_DECLARE(void) filter_delete(filter_t *fi)
{
if (fi)
- free(fi);
+ span_free(fi);
}
/*- End of function --------------------------------------------------------*/
{
cfilter_t *cfi;
- if ((cfi = (cfilter_t *) malloc(sizeof(*cfi))))
+ if ((cfi = (cfilter_t *) span_alloc(sizeof(*cfi))))
{
if ((cfi->ref = filter_create(fs)) == NULL)
{
- free(cfi);
+ span_free(cfi);
return NULL;
}
if ((cfi->imf = filter_create(fs)) == NULL)
{
- free(cfi->ref);
- free(cfi);
+ span_free(cfi->ref);
+ span_free(cfi);
return NULL;
}
}
#include <limits.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
if (s == NULL)
{
- if ((s = (dtmf_rx_state_t *) malloc(sizeof (*s))) == NULL)
+ if ((s = (dtmf_rx_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (dtmf_tx_state_t *) malloc(sizeof (*s))) == NULL)
+ if ((s = (dtmf_tx_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <stdio.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/saturated.h"
int i;
int j;
- if ((ec = (echo_can_state_t *) malloc(sizeof(*ec))) == NULL)
+ if ((ec = (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;
ec->tap_mask = 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);
+ span_free(ec);
return NULL;
}
memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t));
for (i = 0; i < 4; i++)
{
- if ((ec->fir_taps16[i] = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL)
+ if ((ec->fir_taps16[i] = (int16_t *) span_alloc(ec->taps*sizeof(int16_t))) == NULL)
{
for (j = 0; j < i; j++)
- free(ec->fir_taps16[j]);
- free(ec->fir_taps32);
- free(ec);
+ span_free(ec->fir_taps16[j]);
+ span_free(ec->fir_taps32);
+ span_free(ec);
return NULL;
}
memset(ec->fir_taps16[i], 0, ec->taps*sizeof(int16_t));
int i;
fir16_free(&ec->fir_state);
- free(ec->fir_taps32);
+ span_free(ec->fir_taps32);
for (i = 0; i < 4; i++)
- free(ec->fir_taps16[i]);
- free(ec);
+ span_free(ec->fir_taps16[i]);
+ span_free(ec);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <tiffio.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/dc_restore.h"
if (s == NULL)
{
- if ((s = (fax_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (fax_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) fax_free(fax_state_t *s)
{
t30_release(&s->t30);
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#endif
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/dc_restore.h"
{
if (s == NULL)
{
- if ((s = (fax_modems_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (fax_modems_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/*endif*/
SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
/*endif*/
return 0;
}
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/g711.h"
#include "spandsp/private/g711.h"
{
if (s == NULL)
{
- if ((s = (g711_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (g711_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->mode = mode;
SPAN_DECLARE(int) g711_free(g711_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/vector_int.h"
{
if (s == NULL)
{
- if ((s = (g722_decode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (g722_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (g722_encode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (g722_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/bitstream.h"
#include "spandsp/bit_operations.h"
#include "spandsp/g711.h"
return NULL;
if (s == NULL)
{
- if ((s = (g726_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (g726_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->yl = 34816;
SPAN_DECLARE(int) g726_free(g726_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <memory.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/bitstream.h"
#include "spandsp/saturated.h"
{
if (s == NULL)
{
- if ((s = (gsm0610_state_t *) malloc(sizeof (*s))) == NULL)
+ if ((s = (gsm0610_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
/*endif*/
}
SPAN_DECLARE(int) gsm0610_free(gsm0610_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
/*endif*/
return 0;
}
#include <time.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/private/logging.h"
{
if (s == NULL)
{
- if ((s = (logging_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (logging_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->span_message = __span_message;
SPAN_DECLARE(int) span_log_free(logging_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <memory.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/lpc10.h"
#include "spandsp/private/lpc10.h"
if (s == NULL)
{
- if ((s = (lpc10_decode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (lpc10_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/lpc10.h"
#include "spandsp/private/lpc10.h"
if (s == NULL)
{
- if ((s = (lpc10_encode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (lpc10_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <stdio.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
alloced = FALSE;
if (s == NULL)
{
- if ((s = (modem_connect_tones_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (modem_connect_tones_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
alloced = TRUE;
}
break;
default:
if (alloced)
- free(s);
+ span_free(s);
return NULL;
}
return s;
SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (modem_connect_tones_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (modem_connect_tones_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
SPAN_DECLARE(int) modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#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"
{
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;
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/noise.h"
if (s == NULL)
{
- if ((s = (noise_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (noise_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) noise_free(noise_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <string.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/oki_adpcm.h"
#include "spandsp/private/oki_adpcm.h"
return NULL;
if (s == NULL)
{
- if ((s = (oki_adpcm_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (oki_adpcm_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) oki_adpcm_free(oki_adpcm_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <limits.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/playout.h"
static playout_frame_t *queue_get(playout_state_t *s, timestamp_t sender_stamp)
}
else
{
- if ((frame = (playout_frame_t *) malloc(sizeof(*frame))) == NULL)
+ if ((frame = (playout_frame_t *) span_alloc(sizeof(*frame))) == NULL)
return PLAYOUT_ERROR;
}
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
- free(frame);
+ span_free(frame);
}
memset(s, 0, sizeof(*s));
{
playout_state_t *s;
- if ((s = (playout_state_t *) malloc(sizeof(playout_state_t))) == NULL)
+ if ((s = (playout_state_t *) span_alloc(sizeof(playout_state_t))) == NULL)
return NULL;
memset(s, 0, sizeof(*s));
playout_restart(s, min_length, max_length);
for (frame = s->first_frame; frame; frame = next)
{
next = frame->later;
- free(frame);
+ span_free(frame);
}
/* Free all the frames on the free list */
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
- free(frame);
+ span_free(frame);
}
return 0;
}
{
playout_release(s);
/* Finally, free ourselves! */
- free(s);
+ span_free(s);
}
return 0;
}
#include <limits.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/plc.h"
{
if (s == NULL)
{
- if ((s = (plc_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (plc_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) plc_free(plc_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/power_meter.h"
SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift)
{
if (s == NULL)
{
- if ((s = (power_meter_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (power_meter_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->shift = shift;
SPAN_DECLARE(int) power_meter_free(power_meter_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
if (s == NULL)
{
- if ((s = (power_surge_detector_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (power_surge_detector_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#define SPANDSP_FULLY_DEFINE_QUEUE_STATE_T
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/queue.h"
#include "spandsp/private/queue.h"
{
if (s == NULL)
{
- if ((s = (queue_state_t *) malloc(sizeof(*s) + len + 1)) == NULL)
+ if ((s = (queue_state_t *) span_alloc(sizeof(*s) + len + 1)) == NULL)
return NULL;
}
s->iptr =
SPAN_DECLARE(int) queue_free(queue_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <memory.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/schedule.h"
if (i >= s->allocated)
{
s->allocated += 5;
- s->sched = (span_sched_t *) realloc(s->sched, sizeof(span_sched_t)*s->allocated);
+ s->sched = (span_sched_t *) span_realloc(s->sched, sizeof(span_sched_t)*s->allocated);
}
/*endif*/
if (i >= s->max_to_date)
{
if (s->sched)
{
- free(s->sched);
+ span_free(s->sched);
s->sched = NULL;
}
return 0;
{
span_schedule_release(s);
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <limits.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/vector_int.h"
if (s == NULL)
{
- if ((s = (sig_tone_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (sig_tone_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) sig_tone_tx_free(sig_tone_tx_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
if (s == NULL)
{
- if ((s = (sig_tone_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (sig_tone_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) sig_tone_rx_free(sig_tone_rx_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <limits.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/silence_gen.h"
{
if (s == NULL)
{
- if ((s = (silence_gen_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (silence_gen_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) silence_gen_free(silence_gen_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/complex.h"
#include "spandsp/vector_float.h"
desc->pitches[i][1] = desc->monitored_frequencies;
if (desc->monitored_frequencies%5 == 0)
{
- desc->desc = (goertzel_descriptor_t *) realloc(desc->desc, (desc->monitored_frequencies + 5)*sizeof(goertzel_descriptor_t));
+ desc->desc = (goertzel_descriptor_t *) span_realloc(desc->desc, (desc->monitored_frequencies + 5)*sizeof(goertzel_descriptor_t));
}
make_goertzel_descriptor(&desc->desc[desc->monitored_frequencies++], (float) freq, SUPER_TONE_BINS);
desc->used_frequencies++;
{
if (desc->tones%5 == 0)
{
- desc->tone_list = (super_tone_rx_segment_t **) realloc(desc->tone_list, (desc->tones + 5)*sizeof(super_tone_rx_segment_t *));
- desc->tone_segs = (int *) realloc(desc->tone_segs, (desc->tones + 5)*sizeof(int));
+ desc->tone_list = (super_tone_rx_segment_t **) span_realloc(desc->tone_list, (desc->tones + 5)*sizeof(super_tone_rx_segment_t *));
+ desc->tone_segs = (int *) span_realloc(desc->tone_segs, (desc->tones + 5)*sizeof(int));
}
desc->tone_list[desc->tones] = NULL;
desc->tone_segs[desc->tones] = 0;
step = desc->tone_segs[tone];
if (step%5 == 0)
{
- desc->tone_list[tone] = (super_tone_rx_segment_t *) realloc(desc->tone_list[tone], (step + 5)*sizeof(super_tone_rx_segment_t));
+ desc->tone_list[tone] = (super_tone_rx_segment_t *) span_realloc(desc->tone_list[tone], (step + 5)*sizeof(super_tone_rx_segment_t));
}
desc->tone_list[tone][step].f1 = add_super_tone_freq(desc, f1);
desc->tone_list[tone][step].f2 = add_super_tone_freq(desc, f2);
{
if (desc == NULL)
{
- if ((desc = (super_tone_rx_descriptor_t *) malloc(sizeof(*desc))) == NULL)
+ if ((desc = (super_tone_rx_descriptor_t *) span_alloc(sizeof(*desc))) == NULL)
return NULL;
}
desc->tone_list = NULL;
for (i = 0; i < desc->tones; i++)
{
if (desc->tone_list[i])
- free(desc->tone_list[i]);
+ span_free(desc->tone_list[i]);
}
if (desc->tone_list)
- free(desc->tone_list);
+ span_free(desc->tone_list);
if (desc->tone_segs)
- free(desc->tone_segs);
+ span_free(desc->tone_segs);
if (desc->desc)
- free(desc->desc);
- free(desc);
+ span_free(desc->desc);
+ span_free(desc);
}
return 0;
}
return NULL;
if (s == NULL)
{
- if ((s = (super_tone_rx_state_t *) malloc(sizeof(*s) + desc->monitored_frequencies*sizeof(goertzel_state_t))) == NULL)
+ if ((s = (super_tone_rx_state_t *) span_alloc(sizeof(*s) + desc->monitored_frequencies*sizeof(goertzel_state_t))) == NULL)
return NULL;
}
SPAN_DECLARE(int) super_tone_rx_free(super_tone_rx_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
{
if (s == NULL)
{
- if ((s = (super_tone_tx_step_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (super_tone_tx_step_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
if (f1 >= 1.0f)
super_tone_tx_free_tone(s->nest);
t = s;
s = s->next;
- free(t);
+ span_free(t);
}
return 0;
}
return NULL;
if (s == NULL)
{
- if ((s = (super_tone_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (super_tone_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
#include "spandsp/vector_float.h"
{
if (s == NULL)
{
- if ((s = (swept_tone_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (swept_tone_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) swept_tone_free(swept_tone_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <tiffio.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/queue.h"
SPAN_DECLARE(int) t30_set_tx_nsf(t30_state_t *s, const uint8_t *nsf, int len)
{
if (s->tx_info.nsf)
- free(s->tx_info.nsf);
- if (nsf && len > 0 && (s->tx_info.nsf = malloc(len + 3)))
+ span_free(s->tx_info.nsf);
+ if (nsf && len > 0 && (s->tx_info.nsf = span_alloc(len + 3)))
{
memcpy(s->tx_info.nsf + 3, nsf, len);
s->tx_info.nsf_len = len;
SPAN_DECLARE(int) t30_set_tx_nsc(t30_state_t *s, const uint8_t *nsc, int len)
{
if (s->tx_info.nsc)
- free(s->tx_info.nsc);
- if (nsc && len > 0 && (s->tx_info.nsc = malloc(len + 3)))
+ span_free(s->tx_info.nsc);
+ if (nsc && len > 0 && (s->tx_info.nsc = span_alloc(len + 3)))
{
memcpy(s->tx_info.nsc + 3, nsc, len);
s->tx_info.nsc_len = len;
SPAN_DECLARE(int) t30_set_tx_nss(t30_state_t *s, const uint8_t *nss, int len)
{
if (s->tx_info.nss)
- free(s->tx_info.nss);
- if (nss && len > 0 && (s->tx_info.nss = malloc(len + 3)))
+ span_free(s->tx_info.nss);
+ if (nss && len > 0 && (s->tx_info.nss = span_alloc(len + 3)))
{
memcpy(s->tx_info.nss + 3, nss, len);
s->tx_info.nss_len = len;
SPAN_DECLARE(int) t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.tsa)
- free(s->tx_info.tsa);
+ span_free(s->tx_info.tsa);
if (address == NULL || len == 0)
{
s->tx_info.tsa = NULL;
s->tx_info.tsa_type = type;
if (len < 0)
len = strlen(address);
- if ((s->tx_info.tsa = malloc(len)))
+ if ((s->tx_info.tsa = span_alloc(len)))
{
memcpy(s->tx_info.tsa, address, len);
s->tx_info.tsa_len = len;
SPAN_DECLARE(int) t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.ira)
- free(s->tx_info.ira);
+ span_free(s->tx_info.ira);
if (address == NULL)
{
s->tx_info.ira = NULL;
SPAN_DECLARE(int) t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.cia)
- free(s->tx_info.cia);
+ span_free(s->tx_info.cia);
if (address == NULL)
{
s->tx_info.cia = NULL;
SPAN_DECLARE(int) t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.isp)
- free(s->tx_info.isp);
+ span_free(s->tx_info.isp);
if (address == NULL)
{
s->tx_info.isp = NULL;
SPAN_DECLARE(int) t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len)
{
if (s->tx_info.csa)
- free(s->tx_info.csa);
+ span_free(s->tx_info.csa);
if (address == NULL)
{
s->tx_info.csa = NULL;
#include <string.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/t81_t82_arith_coding.h"
#include "spandsp/private/t81_t82_arith_coding.h"
{
if (s == NULL)
{
- if ((s = (t81_t82_arith_encode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t81_t82_arith_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
int ret;
ret = t81_t82_arith_encode_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (t81_t82_arith_decode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t81_t82_arith_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
int ret;
ret = t81_t82_arith_decode_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
#include <time.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/timezone.h"
if (min_len > s->row_buf_len)
{
/* We need to expand the 3 row buffer */
- if ((buf = (uint8_t *) realloc(s->row_buf, min_len)) == NULL)
+ if ((buf = (uint8_t *) span_realloc(s->row_buf, min_len)) == NULL)
return T4_DECODE_NOMEM;
s->row_buf = buf;
s->row_buf_len = min_len;
s->s.nopadding = s->options & T85_VLENGTH;
if (s->comment)
{
- free(s->comment);
+ span_free(s->comment);
s->comment = NULL;
}
s->comment_len = 0;
s->interrupt = s->comment_handler(s->comment_user_data, s->comment, s->comment_len);
if (s->comment)
{
- free(s->comment);
+ span_free(s->comment);
s->comment = NULL;
}
s->comment_len = 0;
s->comment_len = pack_32(&s->buffer[2]);
/* Only try to buffer and process the comment's contents if we have
a defined callback routine to do something with it. */
- /* If this malloc fails we carry on working just fine, and don't try to
+ /* If this allocate fails we carry on working just fine, and don't try to
process the contents of the comment. That is fairly benign, as
the comments are not generally of critical importance, so let's
not worry. */
if (s->comment_handler && s->comment_len > 0 && s->comment_len <= s->max_comment_len)
- s->comment = malloc(s->comment_len);
+ s->comment = span_alloc(s->comment_len);
s->comment_progress = 0;
continue;
case T82_ATMOVE:
s->end_of_data = 0;
if (s->comment)
{
- free(s->comment);
+ span_free(s->comment);
s->comment = NULL;
}
s->comment_len = 0;
s->end_of_data = 0;
if (s->comment)
{
- free(s->comment);
+ span_free(s->comment);
s->comment = NULL;
}
s->comment_len = 0;
{
if (s == NULL)
{
- if ((s = (t85_decode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t85_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
{
if (s->row_buf)
{
- free(s->row_buf);
+ span_free(s->row_buf);
s->row_buf = NULL;
}
if (s->comment)
{
- free(s->comment);
+ span_free(s->comment);
s->comment = NULL;
}
return 0;
int ret;
ret = t85_decode_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
#include <time.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/timezone.h"
/* The number of uncompressed bytes per row seems like a reasonable measure
of what to expect as a poor case for a compressed row. */
bytes_per_row = (s->xd + 7) >> 3;
- if ((new_buf = realloc(s->bitstream, s->bitstream_len + len + bytes_per_row)) == NULL)
+ if ((new_buf = span_realloc(s->bitstream, s->bitstream_len + len + bytes_per_row)) == NULL)
return;
s->bitstream = new_buf;
s->bitstream_len += (len + bytes_per_row);
return -1;
s->xd = image_width;
bytes_per_row = (s->xd + 7) >> 3;
- if ((t = (uint8_t *) realloc(s->row_buf, 3*bytes_per_row)) == NULL)
+ if ((t = (uint8_t *) span_realloc(s->row_buf, 3*bytes_per_row)) == NULL)
return -1;
s->row_buf = t;
memset(s->row_buf, 0, 3*bytes_per_row);
s->bitstream_optr = 0;
if (s->bitstream)
{
- free(s->bitstream);
+ span_free(s->bitstream);
s->bitstream = NULL;
}
s->bitstream_len = 0;
{
if (s == NULL)
{
- if ((s = (t85_encode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t85_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
{
if (s->row_buf)
{
- free(s->row_buf);
+ span_free(s->row_buf);
s->row_buf = NULL;
}
if (s->bitstream)
{
- free(s->bitstream);
+ span_free(s->bitstream);
s->bitstream = NULL;
s->bitstream_len = 0;
}
int ret;
ret = t85_encode_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/time_scale.h"
#include "spandsp/saturated.h"
alloced = FALSE;
if (s == NULL)
{
- if ((s = (time_scale_state_t *) malloc(sizeof (*s))) == NULL)
+ if ((s = (time_scale_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
/*endif*/
alloced = TRUE;
if (time_scale_rate(s, playout_rate))
{
if (alloced)
- free(s);
+ span_free(s);
return NULL;
}
/*endif*/
SPAN_DECLARE(int) time_scale_free(time_scale_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/timezone.h"
#include "spandsp/private/timezone.h"
{
if (tz == NULL)
{
- if ((tz = (tz_t *) malloc(sizeof(*tz))) == NULL)
+ if ((tz = (tz_t *) span_alloc(sizeof(*tz))) == NULL)
return NULL;
}
memset(tz, 0, sizeof(*tz));
SPAN_DECLARE(int) tz_free(tz_t *tz)
{
if (tz)
- free(tz);
+ span_free(tz);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <fcntl.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/complex_vector_float.h"
#include "spandsp/tone_detect.h"
{
if (s == NULL)
{
- if ((s = (goertzel_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (goertzel_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
#if defined(SPANDSP_USE_FIXED_POINT)
SPAN_DECLARE(int) goertzel_free(goertzel_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
{
if (s == NULL)
{
- if ((s = (tone_gen_descriptor_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (tone_gen_descriptor_t *) span_alloc(sizeof(*s))) == NULL)
{
return NULL;
}
SPAN_DECLARE(void) tone_gen_descriptor_free(tone_gen_descriptor_t *s)
{
- free(s);
+ span_free(s);
}
/*- End of function --------------------------------------------------------*/
if (s == NULL)
{
- if ((s = (tone_gen_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (tone_gen_state_t *) span_alloc(sizeof(*s))) == NULL)
{
return NULL;
}
SPAN_DECLARE(int) tone_gen_free(tone_gen_state_t *s)
{
if (s)
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/async.h"
if (ss == NULL)
{
- if ((ss = (v42_state_t *) malloc(sizeof(*ss))) == NULL)
+ if ((ss = (v42_state_t *) span_alloc(sizeof(*ss))) == NULL)
return NULL;
}
memset(ss, 0, sizeof(*ss));
SPAN_DECLARE(int) v42_free(v42_state_t *s)
{
v42_release(s);
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/async.h"
return NULL;
if (s == NULL)
{
- if ((s = (v42bis_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v42bis_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
{
comp_exit(&s->compress);
comp_exit(&s->decompress);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
#include "floating_fudge.h"
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/async.h"
{
if (s == NULL)
{
- if ((s = (v8_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v8_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
int ret;
ret = queue_free(s->tx_queue);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/