diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-19 11:24:28 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-19 11:24:28 +0000 |
commit | e3c150bc67cb158ee854ffb498f0066c79cd842c (patch) | |
tree | 20f74dfb8739d8c5b55e5e66e3824590ed12c2fb | |
parent | 42c4259f685deefabe80947c0583792d24d8e74c (diff) | |
download | busybox-w32-e3c150bc67cb158ee854ffb498f0066c79cd842c.tar.gz busybox-w32-e3c150bc67cb158ee854ffb498f0066c79cd842c.tar.bz2 busybox-w32-e3c150bc67cb158ee854ffb498f0066c79cd842c.zip |
- cleanup memory if opening aliases failed and cleanup was requested.
-rw-r--r-- | modutils/modprobe.c | 17 |
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 | |||
364 | } | 364 | } |
365 | 365 | ||
366 | /* | 366 | /* |
367 | * This function builds a list of dependency rules from /lib/modules/`uname -r\modules.dep. | 367 | * This function builds a list of dependency rules from /lib/modules/`uname -r`\modules.dep. |
368 | * It then fills every modules and aliases with their default options, found by parsing | 368 | * It then fills every modules and aliases with their default options, found by parsing |
369 | * modprobe.conf (or modules.conf, or conf.modules). | 369 | * modprobe.conf (or modules.conf, or conf.modules). |
370 | */ | 370 | */ |
371 | static struct dep_t *build_dep ( void ) | 371 | static struct dep_t *build_dep ( void ) |
@@ -389,7 +389,8 @@ static struct dep_t *build_dep ( void ) | |||
389 | 389 | ||
390 | filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release ); | 390 | filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release ); |
391 | fd = open ( filename, O_RDONLY ); | 391 | fd = open ( filename, O_RDONLY ); |
392 | if (ENABLE_FEATURE_CLEAN_UP) free(filename); | 392 | if (ENABLE_FEATURE_CLEAN_UP) |
393 | free(filename); | ||
393 | if (fd < 0) { | 394 | if (fd < 0) { |
394 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ | 395 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ |
395 | if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) { | 396 | if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) { |
@@ -552,16 +553,16 @@ static struct dep_t *build_dep ( void ) | |||
552 | include_conf (&first, ¤t, buffer, sizeof(buffer), fd); | 553 | include_conf (&first, ¤t, buffer, sizeof(buffer), fd); |
553 | close(fd); | 554 | close(fd); |
554 | 555 | ||
555 | filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release ); | 556 | filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release); |
556 | 557 | fd = open ( filename, O_RDONLY ); | |
557 | if (( fd = open ( filename, O_RDONLY )) < 0 ) { | 558 | if (ENABLE_FEATURE_CLEAN_UP) |
558 | 559 | free(filename); | |
560 | if (fd < 0) { | ||
559 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ | 561 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ |
560 | if (( fd = open ( "/lib/modules/modules.alias", O_RDONLY )) < 0 ) { | 562 | if (( fd = open ( "/lib/modules/modules.alias", O_RDONLY )) < 0 ) { |
561 | return first; | 563 | return first; |
562 | } | 564 | } |
563 | } | 565 | } |
564 | free(filename); | ||
565 | 566 | ||
566 | include_conf (&first, ¤t, buffer, sizeof(buffer), fd); | 567 | include_conf (&first, ¤t, buffer, sizeof(buffer), fd); |
567 | close(fd); | 568 | close(fd); |