From 069f5f8b93e81e005f4dd1f7be00568749dd0c51 Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Sun, 4 Nov 2012 02:44:35 +0000 Subject: [PATCH] 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 ........ Merged revisions 375798 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375799 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_fax.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/res/res_fax.c b/res/res_fax.c index 9cb8292f01..cc3e23fe6a 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -2583,7 +2583,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; -- 2.47.2