Author: coreyfarrell
Date: Thu Nov  6 06:15:54 2014
New Revision: 427467

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=427467
Log:
main/file.c: fix possible extra ast_module_unref to format modules.

fn_wrapper only adds a reference to the format's module if the file
was able to be opened.  If not this causes an unmatched
ast_module_unref in filestream_destructor.  Move ast_module_ref to
get_stream.

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

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

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

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

Modified:
    trunk/   (props changed)
    trunk/main/file.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/main/file.c
URL: 
http://svnview.digium.com/svn/asterisk/trunk/main/file.c?view=diff&rev=427467&r1=427466&r2=427467
==============================================================================
--- trunk/main/file.c (original)
+++ trunk/main/file.c Thu Nov  6 06:15:54 2014
@@ -430,6 +430,7 @@
        int l = sizeof(*s) + fmt->buf_size + fmt->desc_size;    /* total 
allocation size */
        if ( (s = ao2_alloc(l, filestream_destructor)) == NULL)
                return NULL;
+       ast_module_ref(fmt->module);
        s->fmt = fmt;
        s->f = bfile;
 
@@ -467,8 +468,7 @@
        else if (mode == WRAP_REWRITE && f->rewrite && f->rewrite(s, comment))
                ast_log(LOG_WARNING, "Unable to rewrite format %s\n", f->name);
        else {
-               /* preliminary checks succeed. update usecount */
-               ast_module_ref(f->module);
+               /* preliminary checks succeed. */
                ret = 0;
        }
        return ret;


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to