svn commit: trunk/busybox/modutils

aldot at busybox.net aldot at busybox.net
Fri May 19 11:24:29 UTC 2006


Author: aldot
Date: 2006-05-19 04:24:28 -0700 (Fri, 19 May 2006)
New Revision: 15119

Log:
- cleanup memory if opening aliases failed and cleanup was requested.


Modified:
   trunk/busybox/modutils/modprobe.c


Changeset:
Modified: trunk/busybox/modutils/modprobe.c
===================================================================
--- trunk/busybox/modutils/modprobe.c	2006-05-19 11:05:57 UTC (rev 15118)
+++ trunk/busybox/modutils/modprobe.c	2006-05-19 11:24:28 UTC (rev 15119)
@@ -364,8 +364,8 @@
 }
 
 /*
- * This function builds a list of dependency rules from /lib/modules/`uname -r\modules.dep.
- * It then fills every modules and aliases with their  default options, found by parsing
+ * This function builds a list of dependency rules from /lib/modules/`uname -r`\modules.dep.
+ * It then fills every modules and aliases with their default options, found by parsing
  * modprobe.conf (or modules.conf, or conf.modules).
  */
 static struct dep_t *build_dep ( void )
@@ -389,7 +389,8 @@
 
 	filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release );
 	fd = open ( filename, O_RDONLY );
-	if (ENABLE_FEATURE_CLEAN_UP) free(filename);
+	if (ENABLE_FEATURE_CLEAN_UP)
+		free(filename);
 	if (fd < 0) {
 		/* Ok, that didn't work.  Fall back to looking in /lib/modules */
 		if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) {
@@ -552,16 +553,16 @@
 	include_conf (&first, &current, buffer, sizeof(buffer), fd);
 	close(fd);
 
-	filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release );
-
-	if (( fd = open ( filename, O_RDONLY )) < 0 ) {
-
+	filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release);
+	fd = open ( filename, O_RDONLY );
+	if (ENABLE_FEATURE_CLEAN_UP)
+		free(filename);
+	if (fd < 0) {
 		/* Ok, that didn't work.  Fall back to looking in /lib/modules */
 		if (( fd = open ( "/lib/modules/modules.alias", O_RDONLY )) < 0 ) {
 			return first;
 		}
 	}
-	free(filename);
 
 	include_conf (&first, &current, buffer, sizeof(buffer), fd);
 	close(fd);




More information about the busybox-cvs mailing list