From: Tilghman Lesher Date: Sun, 8 Apr 2007 01:39:25 +0000 (+0000) Subject: Bug 9486 - memory leak when opening a filestream X-Git-Tag: 1.2.18~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abe55bf16fb0d733a22c0168f4c6d265ef7eb96e;p=thirdparty%2Fasterisk.git Bug 9486 - memory leak when opening a filestream git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@60660 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/file.c b/file.c index 1067f7ff35..15734ecd2e 100644 --- a/file.c +++ b/file.c @@ -427,10 +427,15 @@ static int ast_filehelper(const char *filename, const char *filename2, const cha 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);