forked from Mirrors/freeswitch
Hopefully all the spandsp functions now use custom allocation routines
This commit is contained in:
parent
799402dd5b
commit
13e8532398
@ -45,6 +45,7 @@
|
||||
#include <tiffio.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/alloc.h"
|
||||
#include "spandsp/logging.h"
|
||||
#include "spandsp/bit_operations.h"
|
||||
#include "spandsp/queue.h"
|
||||
@ -636,89 +637,89 @@ static void release_resources(t30_state_t *s)
|
||||
{
|
||||
if (s->tx_info.nsf)
|
||||
{
|
||||
free(s->tx_info.nsf);
|
||||
span_free(s->tx_info.nsf);
|
||||
s->tx_info.nsf = NULL;
|
||||
}
|
||||
s->tx_info.nsf_len = 0;
|
||||
if (s->tx_info.nsc)
|
||||
{
|
||||
free(s->tx_info.nsc);
|
||||
span_free(s->tx_info.nsc);
|
||||
s->tx_info.nsc = NULL;
|
||||
}
|
||||
s->tx_info.nsc_len = 0;
|
||||
if (s->tx_info.nss)
|
||||
{
|
||||
free(s->tx_info.nss);
|
||||
span_free(s->tx_info.nss);
|
||||
s->tx_info.nss = NULL;
|
||||
}
|
||||
s->tx_info.nss_len = 0;
|
||||
if (s->tx_info.tsa)
|
||||
{
|
||||
free(s->tx_info.tsa);
|
||||
span_free(s->tx_info.tsa);
|
||||
s->tx_info.tsa = NULL;
|
||||
}
|
||||
if (s->tx_info.ira)
|
||||
{
|
||||
free(s->tx_info.ira);
|
||||
span_free(s->tx_info.ira);
|
||||
s->tx_info.ira = NULL;
|
||||
}
|
||||
if (s->tx_info.cia)
|
||||
{
|
||||
free(s->tx_info.cia);
|
||||
span_free(s->tx_info.cia);
|
||||
s->tx_info.cia = NULL;
|
||||
}
|
||||
if (s->tx_info.isp)
|
||||
{
|
||||
free(s->tx_info.isp);
|
||||
span_free(s->tx_info.isp);
|
||||
s->tx_info.isp = NULL;
|
||||
}
|
||||
if (s->tx_info.csa)
|
||||
{
|
||||
free(s->tx_info.csa);
|
||||
span_free(s->tx_info.csa);
|
||||
s->tx_info.csa = NULL;
|
||||
}
|
||||
|
||||
if (s->rx_info.nsf)
|
||||
{
|
||||
free(s->rx_info.nsf);
|
||||
span_free(s->rx_info.nsf);
|
||||
s->rx_info.nsf = NULL;
|
||||
}
|
||||
s->rx_info.nsf_len = 0;
|
||||
if (s->rx_info.nsc)
|
||||
{
|
||||
free(s->rx_info.nsc);
|
||||
span_free(s->rx_info.nsc);
|
||||
s->rx_info.nsc = NULL;
|
||||
}
|
||||
s->rx_info.nsc_len = 0;
|
||||
if (s->rx_info.nss)
|
||||
{
|
||||
free(s->rx_info.nss);
|
||||
span_free(s->rx_info.nss);
|
||||
s->rx_info.nss = NULL;
|
||||
}
|
||||
s->rx_info.nss_len = 0;
|
||||
if (s->rx_info.tsa)
|
||||
{
|
||||
free(s->rx_info.tsa);
|
||||
span_free(s->rx_info.tsa);
|
||||
s->rx_info.tsa = NULL;
|
||||
}
|
||||
if (s->rx_info.ira)
|
||||
{
|
||||
free(s->rx_info.ira);
|
||||
span_free(s->rx_info.ira);
|
||||
s->rx_info.ira = NULL;
|
||||
}
|
||||
if (s->rx_info.cia)
|
||||
{
|
||||
free(s->rx_info.cia);
|
||||
span_free(s->rx_info.cia);
|
||||
s->rx_info.cia = NULL;
|
||||
}
|
||||
if (s->rx_info.isp)
|
||||
{
|
||||
free(s->rx_info.isp);
|
||||
span_free(s->rx_info.isp);
|
||||
s->rx_info.isp = NULL;
|
||||
}
|
||||
if (s->rx_info.csa)
|
||||
{
|
||||
free(s->rx_info.csa);
|
||||
span_free(s->rx_info.csa);
|
||||
s->rx_info.csa = NULL;
|
||||
}
|
||||
}
|
||||
@ -5829,7 +5830,7 @@ static int decode_nsf_nss_nsc(t30_state_t *s, uint8_t *msg[], const uint8_t *pkt
|
||||
{
|
||||
uint8_t *t;
|
||||
|
||||
if ((t = malloc(len - 1)) == NULL)
|
||||
if ((t = span_alloc(len - 1)) == NULL)
|
||||
return 0;
|
||||
memcpy(t, pkt + 1, len - 1);
|
||||
*msg = t;
|
||||
@ -6795,7 +6796,7 @@ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s,
|
||||
{
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (t30_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
if ((s = (t30_state_t *) span_alloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
memset(s, 0, sizeof(*s));
|
||||
@ -6845,7 +6846,7 @@ SPAN_DECLARE(int) t30_release(t30_state_t *s)
|
||||
SPAN_DECLARE(int) t30_free(t30_state_t *s)
|
||||
{
|
||||
t30_release(s);
|
||||
free(s);
|
||||
span_free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <tiffio.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/alloc.h"
|
||||
#include "spandsp/logging.h"
|
||||
#include "spandsp/bit_operations.h"
|
||||
#include "spandsp/async.h"
|
||||
@ -1121,7 +1122,7 @@ SPAN_DECLARE(t4_rx_state_t *) t4_rx_init(t4_rx_state_t *s, const char *file, int
|
||||
allocated = FALSE;
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (t4_rx_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
if ((s = (t4_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
allocated = TRUE;
|
||||
}
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <tiffio.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/alloc.h"
|
||||
#include "spandsp/logging.h"
|
||||
#include "spandsp/bit_operations.h"
|
||||
#include "spandsp/async.h"
|
||||
@ -621,7 +622,7 @@ static int read_tiff_t85_image(t4_tx_state_t *s)
|
||||
if (len > biggest)
|
||||
biggest = len;
|
||||
}
|
||||
if ((raw_data = malloc(biggest)) == NULL)
|
||||
if ((raw_data = span_alloc(biggest)) == NULL)
|
||||
return -1;
|
||||
|
||||
s->tiff.image_size = s->tiff.image_length*((s->tiff.image_width + 7)/8);
|
||||
@ -685,7 +686,7 @@ static int read_tiff_t43_image(t4_tx_state_t *s, uint8_t **buf)
|
||||
total_image_len = 0;
|
||||
for (i = 0; i < num_strips; i++)
|
||||
total_image_len += TIFFRawStripSize(s->tiff.tiff_file, i);
|
||||
if ((raw_data = malloc(total_image_len)) == NULL)
|
||||
if ((raw_data = span_alloc(total_image_len)) == NULL)
|
||||
return -1;
|
||||
|
||||
total_len = 0;
|
||||
@ -704,7 +705,7 @@ static int read_tiff_t43_image(t4_tx_state_t *s, uint8_t **buf)
|
||||
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||
|
||||
image_size = 3*s->metadata.image_length*s->metadata.image_width;
|
||||
if ((*buf = malloc(image_size)) == NULL)
|
||||
if ((*buf = span_alloc(image_size)) == NULL)
|
||||
return -1;
|
||||
|
||||
pack.buf = *buf;
|
||||
@ -751,7 +752,7 @@ static int read_tiff_t42_t81_image(t4_tx_state_t *s)
|
||||
|
||||
for (i = 0; i < num_strips; i++)
|
||||
total_image_len += TIFFRawStripSize(s->tiff.tiff_file, i);
|
||||
if ((raw_data = malloc(total_image_len)) == NULL)
|
||||
if ((raw_data = span_alloc(total_image_len)) == NULL)
|
||||
return -1;
|
||||
|
||||
total_len = 0;
|
||||
@ -985,7 +986,7 @@ static int make_header(t4_tx_state_t *s)
|
||||
|
||||
if (s->header_text == NULL)
|
||||
{
|
||||
if ((s->header_text = malloc(132 + 1)) == NULL)
|
||||
if ((s->header_text = span_alloc(132 + 1)) == NULL)
|
||||
return -1;
|
||||
}
|
||||
/* This is very English oriented, but then most FAX machines are, too. Some
|
||||
@ -1604,7 +1605,7 @@ SPAN_DECLARE(t4_tx_state_t *) t4_tx_init(t4_tx_state_t *s, const char *file, int
|
||||
allocated = FALSE;
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (t4_tx_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
if ((s = (t4_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
allocated = TRUE;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
#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"
|
||||
@ -1526,7 +1527,7 @@ SPAN_DECLARE(v17_rx_state_t *) v17_rx_init(v17_rx_state_t *s, int bit_rate, put_
|
||||
}
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (v17_rx_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
if ((s = (v17_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
memset(s, 0, sizeof(*s));
|
||||
@ -1551,7 +1552,7 @@ SPAN_DECLARE(int) v17_rx_release(v17_rx_state_t *s)
|
||||
|
||||
SPAN_DECLARE(int) v17_rx_free(v17_rx_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
span_free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
Loading…
Reference in New Issue
Block a user