#include <assert.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
#include "spandsp/power_meter.h"
{
if (s == NULL)
{
- if ((s = (fsk_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (fsk_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (fsk_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (fsk_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) fsk_rx_free(fsk_rx_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/async.h"
#include "spandsp/crc.h"
#include "spandsp/bit_operations.h"
{
if (s == NULL)
{
- if ((s = (hdlc_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (hdlc_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
{
if (s == NULL)
{
- if ((s = (hdlc_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (hdlc_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) hdlc_tx_free(hdlc_tx_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/ima_adpcm.h"
{
if (s == NULL)
{
- if ((s = (ima_adpcm_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (ima_adpcm_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/*endif*/
SPAN_DECLARE(int) ima_adpcm_free(ima_adpcm_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/saturated.h"
{
if (s->raw_pixel_row[i] == NULL)
{
- if ((s->raw_pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
+ if ((s->raw_pixel_row[i] = (uint8_t *) span_alloc(raw_row_size)) == NULL)
return -1;
}
memset(s->raw_pixel_row[i], 0, raw_row_size);
{
if (s->pixel_row[i] == NULL)
{
- if ((s->pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
+ if ((s->pixel_row[i] = (uint8_t *) span_alloc(raw_row_size)) == NULL)
return -1;
}
memset(s->pixel_row[i], 0, raw_row_size);
{
if (s == NULL)
{
- if ((s = (image_translate_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (image_translate_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
{
if (s->raw_pixel_row[i])
{
- free(s->raw_pixel_row[i]);
+ span_free(s->raw_pixel_row[i]);
s->raw_pixel_row[i] = NULL;
}
if (s->pixel_row[i])
{
- free(s->pixel_row[i]);
+ span_free(s->pixel_row[i]);
s->pixel_row[i] = NULL;
}
}
int res;
res = image_translate_release(s);
- free(s);
+ span_free(s);
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec)
{
fir16_free(&ec->fir_state);
- free(ec->fir_taps32);
- free(ec->fir_taps16);
- free(ec);
+ span_free(ec->fir_taps32);
+ span_free(ec->fir_taps16);
+ span_free(ec);
}
/*- End of function --------------------------------------------------------*/
ec->curr_pos = ec->taps - 1;
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));
#include <tiffio.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/bitstream.h"
alloced = FALSE;
if (s == NULL)
{
- if ((s = (t31_state_t *) malloc(sizeof (*s))) == NULL)
+ if ((s = (t31_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
/*endif*/
alloced = TRUE;
if ((s->rx_queue = queue_init(NULL, 4096, QUEUE_WRITE_ATOMIC | QUEUE_READ_ATOMIC)) == NULL)
{
if (alloced)
- free(s);
+ span_free(s);
/*endif*/
return NULL;
}
SPAN_DECLARE(int) t31_free(t31_state_t *s)
{
t31_release(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/t38_core.h"
{
if (s == NULL)
{
- if ((s = (t38_core_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t38_core_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) t38_core_free(t38_core_state_t *s)
{
if (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/queue.h"
#include "spandsp/dc_restore.h"
/*endif*/
if (s == NULL)
{
- if ((s = (t38_gateway_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t38_gateway_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
/*endif*/
}
SPAN_DECLARE(int) t38_gateway_free(t38_gateway_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/dc_restore.h"
{
if (s == NULL)
{
- if ((s = (t38_non_ecm_buffer_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t38_non_ecm_buffer_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) t38_non_ecm_buffer_free(t38_non_ecm_buffer_state_t *s)
{
if (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"
if (s == NULL)
{
- if ((s = (t38_terminal_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t38_terminal_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
/*endif*/
}
SPAN_DECLARE(int) t38_terminal_free(t38_terminal_state_t *s)
{
t38_terminal_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/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/saturated.h"
span_log(&s->logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n");
if (s->scan_line_out)
{
- free(s->scan_line_out);
+ span_free(s->scan_line_out);
s->scan_line_out = NULL;
}
if (s->out)
set_itu_fax(s);
- if ((s->scan_line_in = (JSAMPROW) malloc(s->samples_per_pixel*s->image_width)) == NULL)
+ if ((s->scan_line_in = (JSAMPROW) span_alloc(s->samples_per_pixel*s->image_width)) == NULL)
return -1;
if (s->image_type == T4_IMAGE_TYPE_COLOUR_8BIT)
{
- if ((s->scan_line_out = (JSAMPROW) malloc(s->samples_per_pixel*s->image_width)) == NULL)
+ if ((s->scan_line_out = (JSAMPROW) span_alloc(s->samples_per_pixel*s->image_width)) == NULL)
return -1;
for (i = 0; i < s->compressor.image_height; i++)
if (s->scan_line_out)
{
- free(s->scan_line_out);
+ span_free(s->scan_line_out);
s->scan_line_out = NULL;
}
jpeg_finish_compress(&s->compressor);
#else
s->buf_size =
s->compressed_image_size = ftell(s->out);
- if ((s->compressed_buf = malloc(s->compressed_image_size)) == NULL)
+ if ((s->compressed_buf = span_alloc(s->compressed_image_size)) == NULL)
return -1;
if (fseek(s->out, 0, SEEK_SET) != 0)
{
fclose(s->out);
s->out = NULL;
- free(s->compressed_buf);
+ span_free(s->compressed_buf);
s->compressed_buf = NULL;
return -1;
}
{
fclose(s->out);
s->out = NULL;
- free(s->compressed_buf);
+ span_free(s->compressed_buf);
s->compressed_buf = NULL;
return -1;
}
{
if (s == NULL)
{
- if ((s = (t42_encode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t42_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
int ret;
ret = t42_encode_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
span_log(&s->logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n");
if (s->scan_line_out)
{
- free(s->scan_line_out);
+ span_free(s->scan_line_out);
s->scan_line_out = NULL;
}
if (s->in)
jpeg_start_decompress(&s->decompressor);
- if ((s->scan_line_in = malloc(s->samples_per_pixel*s->image_width)) == NULL)
+ if ((s->scan_line_in = span_alloc(s->samples_per_pixel*s->image_width)) == NULL)
return -1;
if (s->samples_per_pixel == 3)
{
- if ((s->scan_line_out = malloc(s->samples_per_pixel*s->image_width)) == NULL)
+ if ((s->scan_line_out = span_alloc(s->samples_per_pixel*s->image_width)) == NULL)
return -1;
while (s->decompressor.output_scanline < s->image_length)
if (s->scan_line_in)
{
- free(s->scan_line_in);
+ span_free(s->scan_line_in);
s->scan_line_in = NULL;
}
if (s->scan_line_out)
{
- free(s->scan_line_out);
+ span_free(s->scan_line_out);
s->scan_line_out = NULL;
}
jpeg_finish_decompress(&s->decompressor);
if (s->compressed_image_size + len > s->buf_size)
{
- if ((buf = (uint8_t *) realloc(s->compressed_buf, s->compressed_image_size + len + 10000)) == NULL)
+ if ((buf = (uint8_t *) span_realloc(s->compressed_buf, s->compressed_image_size + len + 10000)) == NULL)
return -1;
s->buf_size = s->compressed_image_size + len + 10000;
s->compressed_buf = buf;
{
if (s == NULL)
{
- if ((s = (t42_decode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t42_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
{
if (s->scan_line_in)
{
- free(s->scan_line_in);
+ span_free(s->scan_line_in);
s->scan_line_in = NULL;
}
if (s->scan_line_out)
{
- free(s->scan_line_out);
+ span_free(s->scan_line_out);
s->scan_line_out = NULL;
}
jpeg_destroy_decompress(&s->decompressor);
}
if (s->comment)
{
- free(s->comment);
+ span_free(s->comment);
s->comment = NULL;
}
return 0;
int ret;
ret = t42_decode_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
#include <setjmp.h>
#include "spandsp/telephony.h"
+#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/timezone.h"
{
int pos;
int val[6];
+#if 0
int bytes_per_entry;
+#endif
pos = 0;
unpack_16(data, 0xFFA8);
{
if (s == NULL)
{
- if ((s = (t43_encode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t43_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
t85_encode_free(&s->t85);
ret = t43_encode_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
if (s->buf == NULL)
{
image_size = s->samples_per_pixel*s->t85.xd*s->t85.yd;
- if ((s->buf = malloc(image_size)) == NULL)
+ if ((s->buf = span_alloc(image_size)) == NULL)
return -1;
memset(s->buf, 0, image_size);
}
}
/* Now deal the bit-planes, one after another. */
+ total_len = 0;
while (s->current_bit_plane < s->t85.bit_planes)
{
j = s->current_bit_plane;
{
if (s == NULL)
{
- if ((s = (t43_decode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t43_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
ret = t43_decode_release(s);
t85_decode_free(&s->t85);
- free(s);
+ span_free(s);
return ret;
}
/*- 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/async.h"
{
if (s->cur_runs)
{
- free(s->cur_runs);
+ span_free(s->cur_runs);
s->cur_runs = NULL;
}
if (s->ref_runs)
{
- free(s->ref_runs);
+ span_free(s->ref_runs);
s->ref_runs = NULL;
}
if (s->row_buf)
{
- free(s->row_buf);
+ span_free(s->row_buf);
s->row_buf = NULL;
}
s->bytes_per_row = 0;
if (s->bytes_per_row == 0 || image_width != s->image_width)
{
/* Allocate the space required for decoding the new row length. */
- if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL)
+ if ((bufptr = (uint32_t *) span_realloc(s->cur_runs, run_space)) == NULL)
return -1;
s->cur_runs = bufptr;
- if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL)
+ if ((bufptr = (uint32_t *) span_realloc(s->ref_runs, run_space)) == NULL)
return -1;
s->ref_runs = bufptr;
s->image_width = image_width;
bytes_per_row = (image_width + 7)/8;
if (bytes_per_row != s->bytes_per_row)
{
- if ((bufptr8 = (uint8_t *) realloc(s->row_buf, bytes_per_row)) == NULL)
+ if ((bufptr8 = (uint8_t *) span_realloc(s->row_buf, bytes_per_row)) == NULL)
return -1;
s->row_buf = bufptr8;
s->bytes_per_row = bytes_per_row;
{
if (s == NULL)
{
- if ((s = (t4_t6_decode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t4_t6_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
int ret;
ret = t4_t6_decode_release(s);
- free(s);
+ span_free(s);
return ret;
}
/*- 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/async.h"
{
if (s->cur_runs)
{
- free(s->cur_runs);
+ span_free(s->cur_runs);
s->cur_runs = NULL;
}
if (s->ref_runs)
{
- free(s->ref_runs);
+ span_free(s->ref_runs);
s->ref_runs = NULL;
}
if (s->bitstream)
{
- free(s->bitstream);
+ span_free(s->bitstream);
s->bitstream = NULL;
}
s->bytes_per_row = 0;
s->bytes_per_row = (s->image_width + 7)/8;
run_space = (s->image_width + 4)*sizeof(uint32_t);
- if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL)
+ if ((bufptr = (uint32_t *) span_realloc(s->cur_runs, run_space)) == NULL)
return -1;
s->cur_runs = bufptr;
- if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL)
+ if ((bufptr = (uint32_t *) span_realloc(s->ref_runs, run_space)) == NULL)
return -1;
s->ref_runs = bufptr;
- if ((bufptr8 = (uint8_t *) realloc(s->bitstream, (s->image_width + 1)*sizeof(uint16_t))) == NULL)
+ if ((bufptr8 = (uint8_t *) span_realloc(s->bitstream, (s->image_width + 1)*sizeof(uint16_t))) == NULL)
return -1;
s->bitstream = bufptr8;
}
{
if (s == NULL)
{
- if ((s = (t4_t6_encode_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (t4_t6_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
int ret;
ret = t4_t6_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/logging.h"
#include "spandsp/complex.h"
}
if (s == NULL)
{
- if ((s = (v17_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v17_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) v17_tx_free(v17_tx_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/queue.h"
#include "spandsp/async.h"
if (s == NULL)
{
- if ((s = (v18_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v18_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) v18_free(v18_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/logging.h"
#include "spandsp/complex.h"
}
if (s == NULL)
{
- if ((s = (v22bis_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v22bis_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) v22bis_free(v22bis_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/math_fixed.h"
}
if (s == NULL)
{
- if ((s = (v27ter_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v27ter_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) v27ter_rx_free(v27ter_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/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
}
if (s == NULL)
{
- if ((s = (v27ter_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v27ter_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) v27ter_tx_free(v27ter_tx_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/math_fixed.h"
}
if (s == NULL)
{
- if ((s = (v29_rx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v29_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) v29_rx_free(v29_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/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
}
if (s == NULL)
{
- if ((s = (v29_tx_state_t *) malloc(sizeof(*s))) == NULL)
+ if ((s = (v29_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
SPAN_DECLARE(int) v29_tx_free(v29_tx_state_t *s)
{
- free(s);
+ span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/