From c4ad5399c24934248e5259c21f2afe4b5c565f13 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 15 Nov 2006 20:51:18 +0000 Subject: [PATCH 1/1] Merged revisions 47701 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r47701 | kpfleming | 2006-11-15 14:50:06 -0600 (Wed, 15 Nov 2006) | 2 lines don't try to call fclose() if fopen() failed ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47702 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main/file.c b/main/file.c index 8037bef..c6262bf 100644 --- a/main/file.c +++ b/main/file.c @@ -830,12 +830,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 */ -- 1.7.9.5