summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-08-05 15:43:39 -0400
committerCorey Farrell <git@cfware.com>2017-08-05 16:15:31 -0400
commit16cfc3a954e2db42519c32bc5a84ac8ccb367658 (patch)
treecb41c7a92513eefee04c5804b57d1161585effc2 /main/channel.c
parent2ba29df200f924f34d47371b83d0371c824bc76c (diff)
channel: Fix leak on successful call to chan->tech->requester.
joint_cap needs to be released unconditionally as chan->tech->requester does not steal the reference even on success. ASTERISK-27180 #close Change-Id: I647728992559bdb0a9c7357c20be1b36400d68b6
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/main/channel.c b/main/channel.c
index 66825559c..632d47247 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -6022,7 +6022,7 @@ static struct ast_channel *request_channel(const char *type, struct ast_format_c
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
{
struct chanlist *chan;
- struct ast_channel *c;
+ struct ast_channel *c = NULL;
int res;
int foo;
@@ -6063,9 +6063,6 @@ static struct ast_channel *request_channel(const char *type, struct ast_format_c
c = chan->tech->requester_with_stream_topology(type, topology, assignedids, requestor, addr, cause);
ast_stream_topology_free(tmp_converted_topology);
- if (!c) {
- return NULL;
- }
} else if (chan->tech->requester) {
struct ast_format_cap *tmp_converted_cap = NULL;
struct ast_format_cap *tmp_cap;
@@ -6116,12 +6113,10 @@ static struct ast_channel *request_channel(const char *type, struct ast_format_c
ao2_cleanup(tmp_converted_cap);
c = chan->tech->requester(type, joint_cap, assignedids, requestor, addr, cause);
+ ao2_ref(joint_cap, -1);
+ }
- if (!c) {
- ao2_ref(joint_cap, -1);
- return NULL;
- }
- } else {
+ if (!c) {
return NULL;
}