]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix memory leak when using MeetMeAdmin 'e' option with user specified
authorMatthew Jordan <mjordan@digium.com>
Fri, 6 Apr 2012 20:31:39 +0000 (20:31 +0000)
committerMatthew Jordan <mjordan@digium.com>
Fri, 6 Apr 2012 20:31:39 +0000 (20:31 +0000)
A memory leak/reference counting leak occurs if the MeetMeAdmin 'e' command
(eject last user that joined) is used in conjunction with a specified user.
Regardless of the command being executed, if a user is specified for the
command, MeetMeAdmin will look up that user.  Because the 'e' option kicks
the last user that joined, as opposed to the one specified, the reference to
the user specified by the command would be leaked when the user variable
was assigned to the last user that joined.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@361558 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_meetme.c

index 0f23791ea662ad00619c212f961d2678de3f2d9d..6b3d847c4b49549ddfdb59b4ba0b11a4d779eeb7 100644 (file)
@@ -4586,6 +4586,12 @@ static int admin_exec(struct ast_channel *chan, const char *data) {
        case 101: /* e: Eject last user*/
        {
                int max_no = 0;
+
+               /* If they passed in a user, disregard it */
+               if (user) {
+                       ao2_ref(user, -1);
+               }
+
                ao2_callback(cnf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no);
                user = ao2_find(cnf->usercontainer, &max_no, 0);
                if (!ast_test_flag64(&user->userflags, CONFFLAG_ADMIN))