From: Kevin P. Fleming Date: Wed, 15 Nov 2006 20:50:06 +0000 (+0000) Subject: don't try to call fclose() if fopen() failed X-Git-Tag: 1.4.0-beta4~107 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3302cbea3e1658766c96c66bfd70b74d56311f44;p=thirdparty%2Fasterisk.git don't try to call fclose() if fopen() failed git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@47701 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/file.c b/main/file.c index dc664e0821..6c78632626 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 */