From: Mark Spencer Date: Tue, 20 Dec 2005 09:56:55 +0000 (+0000) Subject: Fix segfault on directed pickup when no CDR is available (bug #5998) X-Git-Tag: 1.4.0-beta1~3175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a965978a25dad0ffa9665b7e2d2ab0d751389a4b;p=thirdparty%2Fasterisk.git Fix segfault on directed pickup when no CDR is available (bug #5998) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7541 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index 7008ff083c..9e7d3cc845 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -77,7 +77,7 @@ static int pickup_exec(struct ast_channel *chan, void *data) /* Find a channel to pickup */ origin = ast_get_channel_by_exten_locked(exten, context); - if (origin) { + if (origin && origin->cdr) { ast_cdr_getvar(origin->cdr, "dstchannel", &tmp, workspace, sizeof(workspace), 0); if (tmp) { @@ -89,6 +89,8 @@ static int pickup_exec(struct ast_channel *chan, void *data) } ast_mutex_unlock(&origin->lock); } else { + if (origin) + ast_mutex_unlock(&origin->lock); ast_log(LOG_DEBUG, "No originating channel found.\n"); }