]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 188585 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Wed, 15 Apr 2009 20:20:23 +0000 (20:20 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 15 Apr 2009 20:20:23 +0000 (20:20 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r188585 | mmichelson | 2009-04-15 15:17:33 -0500 (Wed, 15 Apr 2009) | 13 lines

  Merged revisions 188582 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r188582 | mmichelson | 2009-04-15 15:04:20 -0500 (Wed, 15 Apr 2009) | 7 lines

    Update ast_readvideo_callback to match ast_readaudio_callback.

    This fixes potential refcount errors that may occur on ast_filestreams.

    AST-208
  ........
................

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

main/file.c

index e187843b73c277a7102fa485fef4845d1b31d500..0def23c0b8ce70c79a0a93f0038f8962cf3d3447 100644 (file)
@@ -778,12 +778,17 @@ static enum fsread_res ast_readvideo_callback(struct ast_filestream *s)
                        ast_set_flag(fr, AST_FRFLAG_FROM_FILESTREAM);
                        ao2_ref(s, +1);
                }
-               if (!fr || ast_write(s->owner, fr)) { /* no stream or error, as above */
-                       if (fr)
+               if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) {
+                       if (fr) {
                                ast_log(LOG_WARNING, "Failed to write frame\n");
+                               ast_frfree(fr);
+                       }
                        s->owner->vstreamid = -1;
                        return FSREAD_FAILURE;
                }
+               if (fr) {
+                       ast_frfree(fr);
+               }
        }
 
        if (whennext != s->lasttimeout) {