res_fax: Resolve module reference leak caused by reserved sessions
authorCorey Farrell <git@cfware.com>
Tue, 14 Oct 2014 16:20:59 +0000 (16:20 +0000)
committerCorey Farrell <git@cfware.com>
Tue, 14 Oct 2014 16:20:59 +0000 (16:20 +0000)
Remove reference to module providing reserved session after
adding a reference to the final module.  This re-reference
is done to ensure that module references are correct even
if the final session selects a different module than the
reserved session.

ASTERISK-18923 #close
Reported by: Grigoriy Puzankin
Review: https://reviewboard.asterisk.org/r/4048/
........

Merged revisions 425405 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 425407 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 425411 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 425415 from http://svn.asterisk.org/svn/asterisk/branches/13

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

res/res_fax.c

index 247251c..aef6360 100644 (file)
@@ -1281,6 +1281,10 @@ static struct ast_fax_session *fax_session_new(struct ast_fax_session_details *d
                        }
                        ast_debug(4, "Requesting a new FAX session from '%s'.\n", faxmod->tech->description);
                        ast_module_ref(faxmod->tech->module);
+                       if (reserved) {
+                               /* Balance module ref from reserved session */
+                               ast_module_unref(reserved->tech->module);
+                       }
                        s->tech = faxmod->tech;
                        break;
                }