[asterisk-commits] tilghman: branch 1.2 r60660 - /branches/1.2/file.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Apr 7 18:39:26 MST 2007


Author: tilghman
Date: Sat Apr  7 20:39:25 2007
New Revision: 60660

URL: http://svn.digium.com/view/asterisk?view=rev&rev=60660
Log:
Bug 9486 - memory leak when opening a filestream

Modified:
    branches/1.2/file.c

Modified: branches/1.2/file.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/file.c?view=diff&rev=60660&r1=60659&r2=60660
==============================================================================
--- branches/1.2/file.c (original)
+++ branches/1.2/file.c Sat Apr  7 20:39:25 2007
@@ -427,10 +427,15 @@
 										s->fmt = f;
 										s->trans = NULL;
 										s->filename = NULL;
-										if (s->fmt->format < AST_FORMAT_MAX_AUDIO)
+										if (s->fmt->format < AST_FORMAT_MAX_AUDIO) {
+											if (chan->stream)
+												ast_closestream(chan->stream);
 											chan->stream = s;
-										else
+										} else {
+											if (chan->vstream)
+												ast_closestream(chan->vstream);
 											chan->vstream = s;
+										}
 									} else {
 										fclose(bfile);
 										ast_log(LOG_WARNING, "Unable to open file on %s\n", fn);



More information about the asterisk-commits mailing list