From 7019ff68dbb4ff75ababced498e47b8e2e73d2d1 Mon Sep 17 00:00:00 2001 From: Richard Mudgett <rmudgett@digium.com> Date: Tue, 5 May 2009 20:54:07 +0000 Subject: [PATCH] Fixed crashes from issue8824 review board channel locking changes. The local struct ast_party_connected_line connected_caller variable was uninitialized when the copy function was called. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192590 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_dial.c | 2 ++ apps/app_directed_pickup.c | 2 +- apps/app_queue.c | 2 ++ channels/chan_sip.c | 1 + main/features.c | 3 ++- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/app_dial.c b/apps/app_dial.c index 44c122878d..77d8a8623b 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -864,6 +864,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, #endif struct ast_party_connected_line connected_caller; struct ast_str *featurecode = ast_str_alloca(FEATURE_MAX_LEN + 1); + + ast_party_connected_line_init(&connected_caller); if (single) { /* Turn off hold music, etc */ if (!ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK)) diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index 0cf691c597..283846e154 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -97,6 +97,7 @@ static int pickup_do(struct ast_channel *chan, struct ast_channel *target) ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name); connected_caller = target->connected; + ast_party_connected_line_init(&target->connected); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; ast_channel_update_connected_line(chan, &connected_caller); @@ -105,7 +106,6 @@ static int pickup_do(struct ast_channel *chan, struct ast_channel *target) ast_channel_unlock(chan); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; ast_channel_queue_connected_line_update(chan, &connected_caller); - ast_party_connected_line_init(&target->connected); ast_party_connected_line_free(&connected_caller); if ((res = ast_answer(chan))) { diff --git a/apps/app_queue.c b/apps/app_queue.c index 1c9d0b730e..eee4e55696 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -2846,6 +2846,8 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte struct ast_party_connected_line connected_caller; char *inchan_name; + ast_party_connected_line_init(&connected_caller); + ast_channel_lock(qe->chan); inchan_name = ast_strdupa(qe->chan->name); ast_channel_unlock(qe->chan); diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 81111cb9da..5412daa474 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -20104,6 +20104,7 @@ static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual * ast_channel_unlock(targetcall_pvt->owner); } + ast_party_connected_line_init(&connected_caller); if (target.chan2) { if (current->chan2) { /* Tell each of the other channels to whom they are now connected */ diff --git a/main/features.c b/main/features.c index 032e3ec5ef..7944d4cb84 100644 --- a/main/features.c +++ b/main/features.c @@ -1389,7 +1389,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st struct ast_bridge_config bconfig; struct ast_frame *f; int l; - struct ast_party_connected_line connected_line = {{0,},}; + struct ast_party_connected_line connected_line; struct ast_datastore *features_datastore; struct ast_dial_features *dialfeatures = NULL; @@ -1459,6 +1459,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st newchan = feature_request_and_dial(transferer, transferee, "Local", ast_best_codec(transferer->nativeformats), xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1, transferer->language); + ast_party_connected_line_init(&connected_line); if (!ast_check_hangup(transferer)) { /* Transferer is up - old behaviour */ ast_indicate(transferer, -1); -- GitLab