aboutsummaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-19 11:24:28 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-19 11:24:28 +0000
commite3c150bc67cb158ee854ffb498f0066c79cd842c (patch)
tree20f74dfb8739d8c5b55e5e66e3824590ed12c2fb /modutils
parent42c4259f685deefabe80947c0583792d24d8e74c (diff)
downloadbusybox-e3c150bc67cb158ee854ffb498f0066c79cd842c.tar.gz
- cleanup memory if opening aliases failed and cleanup was requested.
Diffstat (limited to 'modutils')
-rw-r--r--modutils/modprobe.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 3f68d64ea..59c06ee1e 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -364,8 +364,8 @@ static void include_conf ( struct dep_t **first, struct dep_t **current, char *b
}
/*
- * 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 @@ static struct dep_t *build_dep ( void )
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 @@ static struct dep_t *build_dep ( void )
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);