summaryrefslogtreecommitdiff
path: root/main/cel.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2009-09-29 21:28:04 +0000
committerMark Michelson <mmichelson@digium.com>2009-09-29 21:28:04 +0000
commit01181a27a051bded1f90f338f7d104f0a6fd6a29 (patch)
treeacaa6a4ab9f5987d820b50ae37e870f059b1a9c1 /main/cel.c
parent75725abeb4d1db826142ce1ebc9fe2f8a5f79d21 (diff)
Fix channel reference leak.
ast_cel_report_event would geet a reference to the bridged channel. However, certain return paths, such as if CEL was not enabled, would result in a reference leak. All return paths now properly unref the channel. (closes issue #15991) Reported by: mmichelson git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@220995 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/cel.c')
-rw-r--r--main/cel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/cel.c b/main/cel.c
index bc16656a5..9fe9993a0 100644
--- a/main/cel.c
+++ b/main/cel.c
@@ -483,6 +483,9 @@ int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event
if (!cel_enabled || !ast_cel_track_event(event_type)) {
ast_mutex_unlock(&reload_lock);
+ if (peer) {
+ ast_channel_unref(peer);
+ }
return 0;
}
@@ -490,6 +493,9 @@ int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event
char *app;
if (!(app = ao2_find(appset, (char *) chan->appl, OBJ_POINTER))) {
ast_mutex_unlock(&reload_lock);
+ if (peer) {
+ ast_channel_unref(peer);
+ }
return 0;
}
ao2_ref(app, -1);