summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJames Golovich <james@gnuinter.net>2004-02-27 04:24:42 +0000
committerJames Golovich <james@gnuinter.net>2004-02-27 04:24:42 +0000
commite8c21dfe67f87b1080188fc3def297070ac47b9b (patch)
tree661dad8f36ade949d766aa5e1fb46369287625bd /apps
parent3439c08170cf131e7e4a8ec737baae7961e6cafa (diff)
Check result of malloc in app_dial.c
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_dial.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index d6bf88736..6acbddba7 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -207,13 +207,19 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
if (o->chan->callerid)
free(o->chan->callerid);
o->chan->callerid = malloc(strlen(in->callerid) + 1);
- strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1);
+ if (o->chan->callerid)
+ strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1);
+ else
+ ast_log(LOG_WARNING, "Out of memory\n");
}
if (in->ani) {
if (o->chan->ani)
free(o->chan->ani);
o->chan->ani = malloc(strlen(in->ani) + 1);
- strncpy(o->chan->ani, in->ani, strlen(in->ani) + 1);
+ if (o->chan->ani)
+ strncpy(o->chan->ani, in->ani, strlen(in->ani) + 1);
+ else
+ ast_log(LOG_WARNING, "Out of memory\n");
}
if (ast_call(o->chan, tmpchan, 0)) {
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);