mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
conversions to memory allocation wrappers (issue #6210)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -56,6 +56,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/localtime.h"
|
#include "asterisk/localtime.h"
|
||||||
#include "asterisk/callerid.h"
|
#include "asterisk/callerid.h"
|
||||||
#include "asterisk/astdb.h"
|
#include "asterisk/astdb.h"
|
||||||
|
#include "asterisk/utils.h"
|
||||||
|
|
||||||
#define ALMRCV_CONFIG "alarmreceiver.conf"
|
#define ALMRCV_CONFIG "alarmreceiver.conf"
|
||||||
#define ADEMCO_CONTACT_ID "ADEMCO_CONTACT_ID"
|
#define ADEMCO_CONTACT_ID "ADEMCO_CONTACT_ID"
|
||||||
@@ -580,17 +581,11 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int
|
|||||||
events_received++;
|
events_received++;
|
||||||
|
|
||||||
/* Queue the Event */
|
/* Queue the Event */
|
||||||
|
if (!(enew = ast_calloc(1, sizeof(*enew)))) {
|
||||||
if((enew = malloc(sizeof(event_node_t))) == NULL){
|
|
||||||
if(option_verbose >= 1)
|
|
||||||
ast_verbose(VERBOSE_PREFIX_1 "AlarmReceiver: Failed to allocate memory\n");
|
|
||||||
ast_log(LOG_WARNING, "AlarmReceiver Failed to allocate memory\n");
|
|
||||||
res = -1;
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(enew, 0, sizeof(event_node_t));
|
|
||||||
|
|
||||||
enew->next = NULL;
|
enew->next = NULL;
|
||||||
ast_copy_string(enew->data, event, sizeof(enew->data));
|
ast_copy_string(enew->data, event, sizeof(enew->data));
|
||||||
|
|
||||||
|
@@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/options.h"
|
#include "asterisk/options.h"
|
||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
|
#include "asterisk/utils.h"
|
||||||
|
|
||||||
static char *tdesc = "Load external URL";
|
static char *tdesc = "Load external URL";
|
||||||
|
|
||||||
@@ -63,9 +64,9 @@ static void *myrealloc(void *ptr, size_t size)
|
|||||||
/* There might be a realloc() out there that doesn't like reallocing
|
/* There might be a realloc() out there that doesn't like reallocing
|
||||||
NULL pointers, so we take care of it here */
|
NULL pointers, so we take care of it here */
|
||||||
if (ptr)
|
if (ptr)
|
||||||
return realloc(ptr, size);
|
return ast_realloc(ptr, size);
|
||||||
else
|
else
|
||||||
return malloc(size);
|
return ast_malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||||
|
@@ -985,12 +985,9 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
}
|
}
|
||||||
*number = '\0';
|
*number = '\0';
|
||||||
number++;
|
number++;
|
||||||
tmp = malloc(sizeof(struct localuser));
|
if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
|
||||||
if (!tmp) {
|
|
||||||
ast_log(LOG_WARNING, "Out of memory\n");
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
memset(tmp, 0, sizeof(struct localuser));
|
|
||||||
if (opts.flags) {
|
if (opts.flags) {
|
||||||
ast_copy_flags(tmp, &opts,
|
ast_copy_flags(tmp, &opts,
|
||||||
OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
|
OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
|
||||||
|
@@ -84,7 +84,7 @@ static char *convert(char *lastname)
|
|||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
int lcount = 0;
|
int lcount = 0;
|
||||||
tmp = malloc(NUMDIGITS + 1);
|
tmp = ast_malloc(NUMDIGITS + 1);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
while((*lastname > 32) && lcount < NUMDIGITS) {
|
while((*lastname > 32) && lcount < NUMDIGITS) {
|
||||||
switch(toupper(*lastname)) {
|
switch(toupper(*lastname)) {
|
||||||
|
@@ -49,6 +49,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/linkedlists.h"
|
#include "asterisk/linkedlists.h"
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
|
#include "asterisk/utils.h"
|
||||||
|
|
||||||
static const char *tdesc = "External IVR Interface Application";
|
static const char *tdesc = "External IVR Interface Application";
|
||||||
|
|
||||||
@@ -113,9 +114,7 @@ static void *gen_alloc(struct ast_channel *chan, void *params)
|
|||||||
struct localuser *u = params;
|
struct localuser *u = params;
|
||||||
struct gen_state *state;
|
struct gen_state *state;
|
||||||
|
|
||||||
state = calloc(1, sizeof(*state));
|
if (!(state = ast_calloc(1, sizeof(*state))))
|
||||||
|
|
||||||
if (!state)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
state->u = u;
|
state->u = u;
|
||||||
@@ -235,9 +234,7 @@ static struct playlist_entry *make_entry(const char *filename)
|
|||||||
{
|
{
|
||||||
struct playlist_entry *entry;
|
struct playlist_entry *entry;
|
||||||
|
|
||||||
entry = calloc(1, sizeof(*entry) + strlen(filename) + 10);
|
if (!(entry = ast_calloc(1, sizeof(*entry) + strlen(filename) + 10)))
|
||||||
|
|
||||||
if (!entry)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
strcpy(entry->filename, filename);
|
strcpy(entry->filename, filename);
|
||||||
|
Reference in New Issue
Block a user