[asterisk-commits] kpfleming: branch 1.4 r47701 - /branches/1.4/main/file.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Nov 15 13:50:06 MST 2006


Author: kpfleming
Date: Wed Nov 15 14:50:06 2006
New Revision: 47701

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47701
Log:
don't try to call fclose() if fopen() failed

Modified:
    branches/1.4/main/file.c

Modified: branches/1.4/main/file.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/file.c?view=diff&rev=47701&r1=47700&r2=47701
==============================================================================
--- branches/1.4/main/file.c (original)
+++ branches/1.4/main/file.c Wed Nov 15 14:50:06 2006
@@ -827,12 +827,13 @@
 		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 */



More information about the asterisk-commits mailing list