]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_fax: Fix reference leak caused by gateway sessions
authorCorey Farrell <git@cfware.com>
Tue, 14 Oct 2014 16:44:13 +0000 (16:44 +0000)
committerCorey Farrell <git@cfware.com>
Tue, 14 Oct 2014 16:44:13 +0000 (16:44 +0000)
Fax gateway session objects can be re-used, causing the
same gateway session to be added to faxregistry.container
more than once.  This change causes fax_session_new to
remove the reserved session from the container before
it's id is changed, ensuring it's possible for the
session to be freed.

ASTERISK-24392 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4049/

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

res/res_fax.c

index 364bb735d15df315997492297f04910edbb61828..5c188032a1f11b18d3e1a7aa3b5b53971d878322 100644 (file)
@@ -992,6 +992,7 @@ static struct ast_fax_session *fax_session_new(struct ast_fax_session_details *d
        if (reserved) {
                s = reserved;
                ao2_ref(reserved, +1);
+               ao2_unlink(faxregistry.container, reserved);
 
                /* NOTE: we don't consume the reference to the reserved
                 * session. The session returned from fax_session_new() is a