diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-15 20:50:06 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-15 20:50:06 +0000 |
commit | 3134607c2ebbdd1d2eb522c33e182005113b9b89 (patch) | |
tree | 9beae10f00e774f48e9521cb858850d95608648b /main | |
parent | 2cced9d1183766b05de295b65032f2b6252a93b2 (diff) |
don't try to call fclose() if fopen() failed
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@47701 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/file.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/main/file.c b/main/file.c index dc664e082..6c7863262 100644 --- a/main/file.c +++ b/main/file.c @@ -827,12 +827,13 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons errno = 0; bfile = fopen(fn, "r"); if (!bfile || (fs = get_filestream(f, bfile)) == NULL || - open_wrapper(fs) ) { + open_wrapper(fs) ) { ast_log(LOG_WARNING, "Unable to open %s\n", fn); - fclose(bfile); - free(fn); if (fs) free(fs); + if (bfile) + fclose(bfile); + free(fn); continue; } /* found it */ |