mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
Check result of malloc in app_dial.c
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -207,13 +207,19 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|||||||
if (o->chan->callerid)
|
if (o->chan->callerid)
|
||||||
free(o->chan->callerid);
|
free(o->chan->callerid);
|
||||||
o->chan->callerid = malloc(strlen(in->callerid) + 1);
|
o->chan->callerid = malloc(strlen(in->callerid) + 1);
|
||||||
|
if (o->chan->callerid)
|
||||||
strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1);
|
strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1);
|
||||||
|
else
|
||||||
|
ast_log(LOG_WARNING, "Out of memory\n");
|
||||||
}
|
}
|
||||||
if (in->ani) {
|
if (in->ani) {
|
||||||
if (o->chan->ani)
|
if (o->chan->ani)
|
||||||
free(o->chan->ani);
|
free(o->chan->ani);
|
||||||
o->chan->ani = malloc(strlen(in->ani) + 1);
|
o->chan->ani = malloc(strlen(in->ani) + 1);
|
||||||
|
if (o->chan->ani)
|
||||||
strncpy(o->chan->ani, in->ani, strlen(in->ani) + 1);
|
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)) {
|
if (ast_call(o->chan, tmpchan, 0)) {
|
||||||
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
|
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
|
||||||
|
Reference in New Issue
Block a user