From: Matthew Jordan Date: Sun, 4 Nov 2012 02:43:25 +0000 (+0000) Subject: Only deref a reserved gateway session if we actually reserved one X-Git-Tag: 11.1.0-rc1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4afa2c0e241e17e8bc0618bb824deff67dba480;p=thirdparty%2Fasterisk.git Only deref a reserved gateway session if we actually reserved one 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) ........ Merged revisions 375797 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@375798 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_fax.c b/res/res_fax.c index 900f21f668..6141dd7a87 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -2574,7 +2574,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;