aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-12 16:08:06 +0000
committerbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-12 16:08:06 +0000
commitd6bead82264a99fbde0a30b0334d5391251ac139 (patch)
tree21f8ee3b9f7fc6bc080356a5027eab93eb1de1e1 /apps
parent1228be721e5731606e2e9553e63883774269a621 (diff)
More new memory wrapper work.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8012 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_milliwatt.c2
-rw-r--r--apps/app_page.c3
-rw-r--r--apps/app_rpt.c17
3 files changed, 8 insertions, 14 deletions
diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c
index 112bc74f1..6c7718f52 100644
--- a/apps/app_milliwatt.c
+++ b/apps/app_milliwatt.c
@@ -60,7 +60,7 @@ static char digital_milliwatt[] = {0x1e,0x0b,0x0b,0x1e,0x9e,0x8b,0x8b,0x9e} ;
static void *milliwatt_alloc(struct ast_channel *chan, void *params)
{
int *indexp;
- indexp = malloc(sizeof(int));
+ indexp = ast_malloc(sizeof(*indexp));
if (indexp == NULL) return(NULL);
*indexp = 0;
return(indexp);
diff --git a/apps/app_page.c b/apps/app_page.c
index 7696a4cc5..da5f19467 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -100,9 +100,8 @@ static void launch_page(struct ast_channel *chan, const char *meetmeopts, const
struct ast_var_t *varptr;
pthread_t t;
pthread_attr_t attr;
- cd = malloc(sizeof(struct calloutdata));
+ cd = ast_calloc(1, sizeof(*cd));
if (cd) {
- memset(cd, 0, sizeof(struct calloutdata));
ast_copy_string(cd->cidnum, chan->cid.cid_num ? chan->cid.cid_num : "", sizeof(cd->cidnum));
ast_copy_string(cd->cidname, chan->cid.cid_name ? chan->cid.cid_name : "", sizeof(cd->cidname));
ast_copy_string(cd->tech, tech, sizeof(cd->tech));
diff --git a/apps/app_rpt.c b/apps/app_rpt.c
index e3f84b166..cc1f1038b 100644
--- a/apps/app_rpt.c
+++ b/apps/app_rpt.c
@@ -1313,7 +1313,7 @@ struct tm localtm;
l = l->next;
continue;
}
- m = malloc(sizeof(struct rpt_link));
+ m = ast_malloc(sizeof(*m));
if (!m)
{
ast_log(LOG_WARNING, "Cannot alloc memory on %s\n", mychannel->name);
@@ -1564,7 +1564,7 @@ struct rpt_tele *tele;
struct rpt_link *mylink = (struct rpt_link *) data;
pthread_attr_t attr;
- tele = malloc(sizeof(struct rpt_tele));
+ tele = ast_malloc(sizeof(*tele));
if (!tele)
{
ast_log(LOG_WARNING, "Unable to allocate memory\n");
@@ -1952,13 +1952,12 @@ static int function_ilink(struct rpt *myrpt, char *param, char *digits, int comm
ast_mutex_unlock(&myrpt->lock);
strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
/* establish call in monitor mode */
- l = malloc(sizeof(struct rpt_link));
+ l = ast_calloc(1, sizeof(*l));
if (!l){
ast_log(LOG_WARNING, "Unable to malloc\n");
return DC_ERROR;
}
/* zero the silly thing */
- memset((char *)l,0,sizeof(struct rpt_link));
snprintf(deststr, sizeof(deststr), "IAX2/%s", s1);
tele = strchr(deststr,'/');
if (!tele){
@@ -2066,13 +2065,11 @@ static int function_ilink(struct rpt *myrpt, char *param, char *digits, int comm
ast_mutex_unlock(&myrpt->lock);
strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
/* establish call in tranceive mode */
- l = malloc(sizeof(struct rpt_link));
+ l = ast_calloc(1, sizeof(*l));
if (!l){
ast_log(LOG_WARNING, "Unable to malloc\n");
return(DC_ERROR);
}
- /* zero the silly thing */
- memset((char *)l,0,sizeof(struct rpt_link));
l->mode = 1;
l->outbound = 1;
strncpy(l->name, digitbuf, MAXNODESTR - 1);
@@ -6017,7 +6014,7 @@ static int rpt_exec(struct ast_channel *chan, void *data)
}
l=strlen(options)+2;
- orig_s=malloc(l);
+ orig_s=ast_malloc(l);
if(!orig_s) {
ast_log(LOG_WARNING, "Out of memory\n");
return -1;
@@ -6229,14 +6226,12 @@ static int rpt_exec(struct ast_channel *chan, void *data)
} else
ast_mutex_unlock(&myrpt->lock);
/* establish call in tranceive mode */
- l = malloc(sizeof(struct rpt_link));
+ l = ast_calloc(1, sizeof(*l));
if (!l)
{
ast_log(LOG_WARNING, "Unable to malloc\n");
pthread_exit(NULL);
}
- /* zero the silly thing */
- memset((char *)l,0,sizeof(struct rpt_link));
l->mode = 1;
strncpy(l->name,b1,MAXNODESTR - 1);
l->isremote = 0;