summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2018-01-08 19:47:38 -0500
committerCorey Farrell <git@cfware.com>2018-01-08 18:58:33 -0600
commitc67eb7031b3a58ff5ce472eee9519b566a222e41 (patch)
tree9095a7ab1c09d77c17fbf1202a59db0aebd8a539
parent7cc614d22363398747bd2c1aa81d3422cf2d07c5 (diff)
app_confbridge: Fix NULL check in action_kick_last.
The check for last_user == NULL needs to happen before we dereference the variable, previously it was possible for us to check flags of a NULL last_user. Change-Id: I274f737aa8af9d2d53e4a78cdd7ad57561003945
-rw-r--r--apps/app_confbridge.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index ae3df7208..e99311d54 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -2666,17 +2666,23 @@ static int action_kick_last(struct confbridge_conference *conference,
}
ao2_lock(conference);
- if (((last_user = AST_LIST_LAST(&conference->active_list)) == user)
- || (ast_test_flag(&last_user->u_profile, USER_OPT_ADMIN))) {
+ last_user = AST_LIST_LAST(&conference->active_list);
+ if (!last_user) {
+ ao2_unlock(conference);
+ return 0;
+ }
+
+ if (last_user == user || ast_test_flag(&last_user->u_profile, USER_OPT_ADMIN)) {
ao2_unlock(conference);
play_file(bridge_channel, NULL,
conf_get_sound(CONF_SOUND_ERROR_MENU, conference->b_profile.sounds));
- } else if (last_user && !last_user->kicked) {
+ } else if (!last_user->kicked) {
last_user->kicked = 1;
pbx_builtin_setvar_helper(last_user->chan, "CONFBRIDGE_RESULT", "KICKED");
ast_bridge_remove(conference->bridge, last_user->chan);
ao2_unlock(conference);
}
+
return 0;
}