mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 03:18:30 +00:00
Merged revisions 60660 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r60660 | tilghman | 2007-04-07 20:39:25 -0500 (Sat, 07 Apr 2007) | 2 lines Bug 9486 - memory leak when opening a filestream ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@60661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
main/file.c
13
main/file.c
@@ -413,10 +413,15 @@ static int ast_filehelper(const char *filename, const void *arg2, const char *fm
|
|||||||
s->fmt = f;
|
s->fmt = f;
|
||||||
s->trans = NULL;
|
s->trans = NULL;
|
||||||
s->filename = 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;
|
chan->stream = s;
|
||||||
else
|
} else {
|
||||||
|
if (chan->vstream)
|
||||||
|
ast_closestream(chan->vstream);
|
||||||
chan->vstream = s;
|
chan->vstream = s;
|
||||||
|
}
|
||||||
free(fn);
|
free(fn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -829,7 +834,7 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
|
|||||||
open_wrapper(fs) ) {
|
open_wrapper(fs) ) {
|
||||||
ast_log(LOG_WARNING, "Unable to open %s\n", fn);
|
ast_log(LOG_WARNING, "Unable to open %s\n", fn);
|
||||||
if (fs)
|
if (fs)
|
||||||
free(fs);
|
ast_free(fs);
|
||||||
if (bfile)
|
if (bfile)
|
||||||
fclose(bfile);
|
fclose(bfile);
|
||||||
free(fn);
|
free(fn);
|
||||||
@@ -945,7 +950,7 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
|
|||||||
unlink(orig_fn);
|
unlink(orig_fn);
|
||||||
}
|
}
|
||||||
if (fs)
|
if (fs)
|
||||||
free(fs);
|
ast_free(fs);
|
||||||
}
|
}
|
||||||
fs->trans = NULL;
|
fs->trans = NULL;
|
||||||
fs->fmt = f;
|
fs->fmt = f;
|
||||||
|
|||||||
Reference in New Issue
Block a user