From b5a869b53c73c2f7c09dcafdca333915b0cab279 Mon Sep 17 00:00:00 2001 From: markster Date: Tue, 20 Dec 2005 09:56:55 +0000 Subject: Fix segfault on directed pickup when no CDR is available (bug #5998) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7541 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_directed_pickup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apps/app_directed_pickup.c') diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index 7008ff083..9e7d3cc84 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"); } -- cgit v1.2.3