summaryrefslogtreecommitdiff
path: root/main/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/file.c')
-rw-r--r--main/file.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/main/file.c b/main/file.c
index 79b4e8486..30780b63c 100644
--- a/main/file.c
+++ b/main/file.c
@@ -329,6 +329,15 @@ static void filestream_destructor(void *arg)
if (f->trans)
ast_translator_free_path(f->trans);
+ if (f->fmt->close) {
+ void (*closefn)(struct ast_filestream *) = f->fmt->close;
+ closefn(f);
+ }
+
+ if (f->f) {
+ fclose(f->f);
+ }
+
if (f->realfilename && f->filename) {
pid = ast_safe_fork(0);
if (!pid) {
@@ -345,12 +354,6 @@ static void filestream_destructor(void *arg)
free(f->filename);
if (f->realfilename)
free(f->realfilename);
- if (f->fmt->close) {
- void (*closefn)(struct ast_filestream *) = f->fmt->close;
- closefn(f);
- }
- if (f->f)
- fclose(f->f);
if (f->vfs)
ast_closestream(f->vfs);
if (f->write_buffer) {