replace all malloc calls to zap_malloc
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@862 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
c3a1f65be9
commit
a2b4369cc2
|
@ -32,7 +32,7 @@
|
||||||
*
|
*
|
||||||
* 2005 03 20 R. Krten created
|
* 2005 03 20 R. Krten created
|
||||||
*/
|
*/
|
||||||
|
#include <openzap.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -134,7 +134,7 @@ dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr)
|
||||||
double phi_mark, phi_space;
|
double phi_mark, phi_space;
|
||||||
dsp_fsk_handle_t *handle;
|
dsp_fsk_handle_t *handle;
|
||||||
|
|
||||||
handle = malloc(sizeof(*handle));
|
handle = zap_malloc(sizeof(*handle));
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr)
|
||||||
|
|
||||||
/* allocate the correlation sin/cos arrays and initialize */
|
/* allocate the correlation sin/cos arrays and initialize */
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
handle->correlates[i] = malloc(sizeof(double) * handle->corrsize);
|
handle->correlates[i] = zap_malloc(sizeof(double) * handle->corrsize);
|
||||||
if (handle->correlates[i] == NULL) {
|
if (handle->correlates[i] == NULL) {
|
||||||
/* some failed, back out memory allocations */
|
/* some failed, back out memory allocations */
|
||||||
dsp_fsk_destroy(&handle);
|
dsp_fsk_destroy(&handle);
|
||||||
|
@ -177,7 +177,7 @@ dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the ring buffer */
|
/* initialize the ring buffer */
|
||||||
handle->buffer = malloc(sizeof(double) * handle->corrsize);
|
handle->buffer = zap_malloc(sizeof(double) * handle->corrsize);
|
||||||
if (!handle->buffer) { /* failed; back out memory allocations */
|
if (!handle->buffer) { /* failed; back out memory allocations */
|
||||||
dsp_fsk_destroy(&handle);
|
dsp_fsk_destroy(&handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "openzap.h"
|
||||||
#include "hashtable.h"
|
#include "hashtable.h"
|
||||||
#include "hashtable_private.h"
|
#include "hashtable_private.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -69,9 +70,9 @@ create_hashtable(unsigned int minsize,
|
||||||
for (pindex=0; pindex < prime_table_length; pindex++) {
|
for (pindex=0; pindex < prime_table_length; pindex++) {
|
||||||
if (primes[pindex] > minsize) { size = primes[pindex]; break; }
|
if (primes[pindex] > minsize) { size = primes[pindex]; break; }
|
||||||
}
|
}
|
||||||
h = (struct hashtable *)malloc(sizeof(struct hashtable));
|
h = (struct hashtable *)zap_malloc(sizeof(struct hashtable));
|
||||||
if (NULL == h) return NULL; /*oom*/
|
if (NULL == h) return NULL; /*oom*/
|
||||||
h->table = (struct entry **)malloc(sizeof(struct entry*) * size);
|
h->table = (struct entry **)zap_malloc(sizeof(struct entry*) * size);
|
||||||
if (NULL == h->table) { free(h); return NULL; } /*oom*/
|
if (NULL == h->table) { free(h); return NULL; } /*oom*/
|
||||||
memset(h->table, 0, size * sizeof(struct entry *));
|
memset(h->table, 0, size * sizeof(struct entry *));
|
||||||
h->tablelength = size;
|
h->tablelength = size;
|
||||||
|
@ -110,7 +111,7 @@ hashtable_expand(struct hashtable *h)
|
||||||
if (h->primeindex == (prime_table_length - 1)) return 0;
|
if (h->primeindex == (prime_table_length - 1)) return 0;
|
||||||
newsize = primes[++(h->primeindex)];
|
newsize = primes[++(h->primeindex)];
|
||||||
|
|
||||||
newtable = (struct entry **)malloc(sizeof(struct entry*) * newsize);
|
newtable = (struct entry **)zap_malloc(sizeof(struct entry*) * newsize);
|
||||||
if (NULL != newtable)
|
if (NULL != newtable)
|
||||||
{
|
{
|
||||||
memset(newtable, 0, newsize * sizeof(struct entry *));
|
memset(newtable, 0, newsize * sizeof(struct entry *));
|
||||||
|
@ -178,7 +179,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags)
|
||||||
* element may be ok. Next time we insert, we'll try expanding again.*/
|
* element may be ok. Next time we insert, we'll try expanding again.*/
|
||||||
hashtable_expand(h);
|
hashtable_expand(h);
|
||||||
}
|
}
|
||||||
e = (struct entry *)malloc(sizeof(struct entry));
|
e = (struct entry *)zap_malloc(sizeof(struct entry));
|
||||||
if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
|
if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
|
||||||
e->h = hash(h,k);
|
e->h = hash(h,k);
|
||||||
index = indexFor(h->tablelength,e->h);
|
index = indexFor(h->tablelength,e->h);
|
||||||
|
|
|
@ -753,19 +753,19 @@ ZIO_CODEC_FUNCTION(zio_alaw2ulaw);
|
||||||
\brief Allocate uninitialized memory
|
\brief Allocate uninitialized memory
|
||||||
\command chunksize the chunk size
|
\command chunksize the chunk size
|
||||||
*/
|
*/
|
||||||
#define zap_malloc(chunksize) g_zap_mem_handler.malloc(g_zap_mem_handler.pool, chunksize);
|
#define zap_malloc(chunksize) g_zap_mem_handler.malloc(g_zap_mem_handler.pool, chunksize)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Allocate initialized memory
|
\brief Allocate initialized memory
|
||||||
\command chunksize the chunk size
|
\command chunksize the chunk size
|
||||||
*/
|
*/
|
||||||
#define zap_calloc(elements, chunksize) g_zap_mem_handler.calloc(g_zap_mem_handler.pool, elements, chunksize);
|
#define zap_calloc(elements, chunksize) g_zap_mem_handler.calloc(g_zap_mem_handler.pool, elements, chunksize)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Free chunk of memory
|
\brief Free chunk of memory
|
||||||
\command chunksize the chunk size
|
\command chunksize the chunk size
|
||||||
*/
|
*/
|
||||||
#define zap_free(chunk) g_zap_mem_handler.free(g_zap_mem_handler.pool, chunk);
|
#define zap_free(chunk) g_zap_mem_handler.free(g_zap_mem_handler.pool, chunk)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Free a pointer and set it to NULL unless it already is NULL
|
\brief Free a pointer and set it to NULL unless it already is NULL
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include "openzap.h"
|
||||||
#include "Q921.h"
|
#include "Q921.h"
|
||||||
#include "Q921priv.h"
|
#include "Q921priv.h"
|
||||||
#include "mfifo.h"
|
#include "mfifo.h"
|
||||||
|
@ -397,7 +398,7 @@ int Q921_InitTrunk(L2TRUNK trunk,
|
||||||
/*
|
/*
|
||||||
* Allocate space for per-link context(s)
|
* Allocate space for per-link context(s)
|
||||||
*/
|
*/
|
||||||
trunk->context = malloc(numlinks * sizeof(struct Q921_Link));
|
trunk->context = zap_malloc(numlinks * sizeof(struct Q921_Link));
|
||||||
if(!trunk->context)
|
if(!trunk->context)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libteletone.h>
|
#include <libteletone.h>
|
||||||
|
#include "openzap.h"
|
||||||
|
|
||||||
#define SMAX 32767
|
#define SMAX 32767
|
||||||
#define SMIN -32768
|
#define SMIN -32768
|
||||||
|
@ -273,7 +274,7 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone
|
||||||
static char *my_strdup (const char *s)
|
static char *my_strdup (const char *s)
|
||||||
{
|
{
|
||||||
size_t len = strlen (s) + 1;
|
size_t len = strlen (s) + 1;
|
||||||
void *new = malloc (len);
|
void *new = zap_malloc(len);
|
||||||
|
|
||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -122,7 +122,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span)
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
analog_data = malloc(sizeof(*analog_data));
|
analog_data = zap_malloc(sizeof(*analog_data));
|
||||||
assert(analog_data != NULL);
|
assert(analog_data != NULL);
|
||||||
memset(analog_data, 0, sizeof(*analog_data));
|
memset(analog_data, 0, sizeof(*analog_data));
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_em_configure_span)
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
analog_data = malloc(sizeof(*analog_data));
|
analog_data = zap_malloc(sizeof(*analog_data));
|
||||||
assert(analog_data != NULL);
|
assert(analog_data != NULL);
|
||||||
memset(analog_data, 0, sizeof(*analog_data));
|
memset(analog_data, 0, sizeof(*analog_data));
|
||||||
|
|
||||||
|
|
|
@ -2263,7 +2263,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span)
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
isdn_data = malloc(sizeof(*isdn_data));
|
isdn_data = zap_malloc(sizeof(*isdn_data));
|
||||||
assert(isdn_data != NULL);
|
assert(isdn_data != NULL);
|
||||||
memset(isdn_data, 0, sizeof(*isdn_data));
|
memset(isdn_data, 0, sizeof(*isdn_data));
|
||||||
|
|
||||||
|
@ -2333,7 +2333,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span)
|
||||||
if (isdn_data->mode == Q931_NT) {
|
if (isdn_data->mode == Q931_NT) {
|
||||||
zap_isdn_bchan_data_t *data;
|
zap_isdn_bchan_data_t *data;
|
||||||
|
|
||||||
data = malloc((span->chan_count - 1) * sizeof(zap_isdn_bchan_data_t));
|
data = zap_malloc((span->chan_count - 1) * sizeof(zap_isdn_bchan_data_t));
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1272,7 +1272,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_libpri_configure_span)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
isdn_data = malloc(sizeof(*isdn_data));
|
isdn_data = zap_malloc(sizeof(*isdn_data));
|
||||||
assert(isdn_data != NULL);
|
assert(isdn_data != NULL);
|
||||||
memset(isdn_data, 0, sizeof(*isdn_data));
|
memset(isdn_data, 0, sizeof(*isdn_data));
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ static ZIO_CONFIGURE_FUNCTION(pika_configure)
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
|
|
||||||
if (!(profile = (pika_channel_profile_t *) hashtable_search(globals.profile_hash, (char *)category))) {
|
if (!(profile = (pika_channel_profile_t *) hashtable_search(globals.profile_hash, (char *)category))) {
|
||||||
profile = malloc(sizeof(*profile));
|
profile = zap_malloc(sizeof(*profile));
|
||||||
memset(profile, 0, sizeof(*profile));
|
memset(profile, 0, sizeof(*profile));
|
||||||
zap_set_string(profile->name, category);
|
zap_set_string(profile->name, category);
|
||||||
profile->ec_config = globals.ec_config;
|
profile->ec_config = globals.ec_config;
|
||||||
|
@ -348,7 +348,7 @@ static unsigned pika_open_range(zap_span_t *span, unsigned boardno, unsigned spa
|
||||||
if (span->mod_data) {
|
if (span->mod_data) {
|
||||||
span_data = span->mod_data;
|
span_data = span->mod_data;
|
||||||
} else {
|
} else {
|
||||||
span_data = malloc(sizeof(*span_data));
|
span_data = zap_malloc(sizeof(*span_data));
|
||||||
assert(span_data != NULL);
|
assert(span_data != NULL);
|
||||||
memset(span_data, 0, sizeof(*span_data));
|
memset(span_data, 0, sizeof(*span_data));
|
||||||
span_data->boardno = boardno;
|
span_data->boardno = boardno;
|
||||||
|
@ -376,7 +376,7 @@ static unsigned pika_open_range(zap_span_t *span, unsigned boardno, unsigned spa
|
||||||
zap_channel_t *chan;
|
zap_channel_t *chan;
|
||||||
pika_chan_data_t *chan_data = NULL;
|
pika_chan_data_t *chan_data = NULL;
|
||||||
|
|
||||||
chan_data = malloc(sizeof *chan_data);
|
chan_data = zap_malloc(sizeof *chan_data);
|
||||||
assert(chan_data);
|
assert(chan_data);
|
||||||
memset(chan_data, 0, sizeof(*chan_data));
|
memset(chan_data, 0, sizeof(*chan_data));
|
||||||
zap_span_add_channel(span, 0, type, &chan);
|
zap_span_add_channel(span, 0, type, &chan);
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <pthread.h>
|
|
||||||
#include <openr2.h>
|
#include <openr2.h>
|
||||||
#include "openzap.h"
|
#include "openzap.h"
|
||||||
|
|
||||||
|
@ -738,7 +737,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_r2_configure_span)
|
||||||
}
|
}
|
||||||
openr2_log_level_t tmplevel;
|
openr2_log_level_t tmplevel;
|
||||||
char *clevel;
|
char *clevel;
|
||||||
char *logval = malloc(strlen(val)+1); /* alloca man page scared me, so better to use good ol' malloc */
|
char *logval = zap_malloc(strlen(val)+1); /* alloca man page scared me, so better to use good ol' malloc */
|
||||||
if (!logval) {
|
if (!logval) {
|
||||||
zap_log(ZAP_LOG_WARNING, "Ignoring R2 logging parameter: '%s', failed to alloc memory\n", val);
|
zap_log(ZAP_LOG_WARNING, "Ignoring R2 logging parameter: '%s', failed to alloc memory\n", val);
|
||||||
continue;
|
continue;
|
||||||
|
@ -811,14 +810,14 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_r2_configure_span)
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
r2data = malloc(sizeof(*r2data));
|
r2data = zap_malloc(sizeof(*r2data));
|
||||||
if (!r2data) {
|
if (!r2data) {
|
||||||
snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate R2 data.");
|
snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate R2 data.");
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
memset(r2data, 0, sizeof(*r2data));
|
memset(r2data, 0, sizeof(*r2data));
|
||||||
|
|
||||||
spanpvt = malloc(sizeof(*spanpvt));
|
spanpvt = zap_malloc(sizeof(*spanpvt));
|
||||||
if (!spanpvt) {
|
if (!spanpvt) {
|
||||||
snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate private span data container.");
|
snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate private span data container.");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -862,7 +861,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_r2_configure_span)
|
||||||
openr2_chan_set_log_level(r2chan, r2conf.loglevel);
|
openr2_chan_set_log_level(r2chan, r2conf.loglevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
r2call = malloc(sizeof(*r2call));
|
r2call = zap_malloc(sizeof(*r2call));
|
||||||
if (!r2call) {
|
if (!r2call) {
|
||||||
snprintf(span->last_error, sizeof(span->last_error), "Cannot create all R2 call data structures for the span.");
|
snprintf(span->last_error, sizeof(span->last_error), "Cannot create all R2 call data structures for the span.");
|
||||||
zap_safe_free(r2chan);
|
zap_safe_free(r2chan);
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
* 2005 06 11 R. Krten created
|
* 2005 06 11 R. Krten created
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <openzap.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -76,7 +77,7 @@ dsp_uart_handle_t *dsp_uart_create(dsp_uart_attr_t *attr)
|
||||||
{
|
{
|
||||||
dsp_uart_handle_t *handle;
|
dsp_uart_handle_t *handle;
|
||||||
|
|
||||||
handle = malloc(sizeof (*handle));
|
handle = zap_malloc(sizeof (*handle));
|
||||||
if (handle) {
|
if (handle) {
|
||||||
memset(handle, 0, sizeof (*handle));
|
memset(handle, 0, sizeof (*handle));
|
||||||
|
|
||||||
|
|
|
@ -53,12 +53,12 @@ OZ_DECLARE(zap_status_t) zap_buffer_create(zap_buffer_t **buffer, zap_size_t blo
|
||||||
{
|
{
|
||||||
zap_buffer_t *new_buffer;
|
zap_buffer_t *new_buffer;
|
||||||
|
|
||||||
new_buffer = malloc(sizeof(*new_buffer));
|
new_buffer = zap_malloc(sizeof(*new_buffer));
|
||||||
if (new_buffer) {
|
if (new_buffer) {
|
||||||
memset(new_buffer, 0, sizeof(*new_buffer));
|
memset(new_buffer, 0, sizeof(*new_buffer));
|
||||||
|
|
||||||
if (start_len) {
|
if (start_len) {
|
||||||
new_buffer->data = malloc(start_len);
|
new_buffer->data = zap_malloc(start_len);
|
||||||
if (!new_buffer->data) {
|
if (!new_buffer->data) {
|
||||||
free(new_buffer);
|
free(new_buffer);
|
||||||
return ZAP_MEMERR;
|
return ZAP_MEMERR;
|
||||||
|
|
|
@ -35,8 +35,6 @@
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#endif
|
#endif
|
||||||
#include "openzap.h"
|
#include "openzap.h"
|
||||||
//#include "zap_isdn.h"
|
|
||||||
//#include "zap_ss7_boost.h"
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -426,7 +424,7 @@ OZ_DECLARE(zap_status_t) zap_span_create(zap_io_interface_t *zio, zap_span_t **s
|
||||||
zap_mutex_lock(globals.mutex);
|
zap_mutex_lock(globals.mutex);
|
||||||
|
|
||||||
if (globals.span_index < ZAP_MAX_SPANS_INTERFACE) {
|
if (globals.span_index < ZAP_MAX_SPANS_INTERFACE) {
|
||||||
new_span = malloc(sizeof(*new_span));
|
new_span = zap_malloc(sizeof(*new_span));
|
||||||
assert(new_span);
|
assert(new_span);
|
||||||
memset(new_span, 0, sizeof(*new_span));
|
memset(new_span, 0, sizeof(*new_span));
|
||||||
status = zap_mutex_create(&new_span->mutex);
|
status = zap_mutex_create(&new_span->mutex);
|
||||||
|
@ -554,7 +552,7 @@ OZ_DECLARE(zap_status_t) zap_span_add_channel(zap_span_t *span, zap_socket_t soc
|
||||||
zap_channel_t *new_chan = span->channels[++span->chan_count];
|
zap_channel_t *new_chan = span->channels[++span->chan_count];
|
||||||
|
|
||||||
if (!new_chan) {
|
if (!new_chan) {
|
||||||
if (!(new_chan = malloc(sizeof(*new_chan)))) {
|
if (!(new_chan = zap_malloc(sizeof(*new_chan)))) {
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
span->channels[span->chan_count] = new_chan;
|
span->channels[span->chan_count] = new_chan;
|
||||||
|
@ -3112,7 +3110,7 @@ OZ_DECLARE(int) zap_vasprintf(char **ret, const char *fmt, va_list ap) /* code f
|
||||||
|
|
||||||
len = vsnprintf(tmp, 0, fmt, ap2);
|
len = vsnprintf(tmp, 0, fmt, ap2);
|
||||||
|
|
||||||
if (len > 0 && (buf = malloc((buflen = (size_t) (len + 1)))) != NULL) {
|
if (len > 0 && (buf = zap_malloc((buflen = (size_t) (len + 1)))) != NULL) {
|
||||||
len = vsnprintf(buf, buflen, fmt, ap);
|
len = vsnprintf(buf, buflen, fmt, ap);
|
||||||
*ret = buf;
|
*ret = buf;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -399,7 +399,7 @@ static ZIO_CONFIGURE_FUNCTION(m3ua_configure)
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
|
|
||||||
if (!(profile = (m3ua_channel_profile_t *) hashtable_search(globals.profile_hash, (char *)category))) {
|
if (!(profile = (m3ua_channel_profile_t *) hashtable_search(globals.profile_hash, (char *)category))) {
|
||||||
profile = malloc(sizeof(*profile));
|
profile = zap_malloc(sizeof(*profile));
|
||||||
memset(profile, 0, sizeof(*profile));
|
memset(profile, 0, sizeof(*profile));
|
||||||
zap_set_string(profile->name, category);
|
zap_set_string(profile->name, category);
|
||||||
hashtable_insert(globals.profile_hash, (void *)profile->name, profile);
|
hashtable_insert(globals.profile_hash, (void *)profile->name, profile);
|
||||||
|
|
|
@ -99,7 +99,7 @@ OZ_DECLARE(zap_status_t) zap_thread_create_detached_ex(zap_thread_function_t fun
|
||||||
zap_thread_t *thread = NULL;
|
zap_thread_t *thread = NULL;
|
||||||
zap_status_t status = ZAP_FAIL;
|
zap_status_t status = ZAP_FAIL;
|
||||||
|
|
||||||
if (!func || !(thread = (zap_thread_t *)malloc(sizeof(zap_thread_t)))) {
|
if (!func || !(thread = (zap_thread_t *)zap_malloc(sizeof(zap_thread_t)))) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ OZ_DECLARE(zap_status_t) zap_mutex_create(zap_mutex_t **mutex)
|
||||||
#endif
|
#endif
|
||||||
zap_mutex_t *check = NULL;
|
zap_mutex_t *check = NULL;
|
||||||
|
|
||||||
check = (zap_mutex_t *)malloc(sizeof(**mutex));
|
check = (zap_mutex_t *)zap_malloc(sizeof(**mutex));
|
||||||
if (!check)
|
if (!check)
|
||||||
goto done;
|
goto done;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -242,7 +242,7 @@ OZ_DECLARE(zap_status_t) zap_condition_create(zap_condition_t **incondition, zap
|
||||||
return ZAP_NOTIMPL;
|
return ZAP_NOTIMPL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
condition = malloc(sizeof(*condition));
|
condition = zap_malloc(sizeof(*condition));
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue