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
This commit is contained in:
Tilghman Lesher
2007-04-08 01:39:25 +00:00
parent d971b4ba93
commit abe55bf16f

9
file.c
View File

@@ -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);