]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Only deref a reserved gateway session if we actually reserved one
authorMatthew Jordan <mjordan@digium.com>
Sun, 4 Nov 2012 02:42:43 +0000 (02:42 +0000)
committerMatthew Jordan <mjordan@digium.com>
Sun, 4 Nov 2012 02:42:43 +0000 (02:42 +0000)
Its perfectly acceptable to have a gateway session unreserved when we go to
first allocate one.  Unreffing the reserved gateway session - when its NULL -
will result in an assertion error.

This problem was caught by the Asterisk Test Suite (once we had enough of the
debugging flags enabled)

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

res/res_fax.c

index 3bec8b6665144ee31709aa96236ca847ad0e949e..836973829f3bef5f39ddd07797647eb345b2c30d 100644 (file)
@@ -2549,7 +2549,9 @@ static int fax_gateway_start(struct fax_gateway *gateway, struct ast_fax_session
        }
        /* release the reference for the reserved session and replace it with
         * the real session */
-       ao2_ref(gateway->s, -1);
+       if (gateway->s) {
+               ao2_ref(gateway->s, -1);
+       }
        gateway->s = s;
        gateway->token = NULL;