diff options
author | Rob Landley | 2006-05-18 20:41:43 +0000 |
---|---|---|
committer | Rob Landley | 2006-05-18 20:41:43 +0000 |
commit | 3afb070e6df906570f3ad1b0df099517bff6537a (patch) | |
tree | a6a7bc263bbfc8b61b459051f2084462892f1d24 | |
parent | d2ccc2ba2609916e7dda5a6e57f0658baefc94fb (diff) | |
download | busybox-3afb070e6df906570f3ad1b0df099517bff6537a.zip busybox-3afb070e6df906570f3ad1b0df099517bff6537a.tar.gz |
Avoid a memory leak pointed out by Lucas C. Villa Real.
-rw-r--r-- | modutils/modprobe.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 2925dd2..3f68d64 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -388,15 +388,14 @@ static struct dep_t *build_dep ( void ) } filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release ); - - if (( fd = open ( filename, O_RDONLY )) < 0 ) { - + 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.dep", O_RDONLY )) < 0 ) { return 0; } } - free(filename); while ( reads ( fd, buffer, sizeof( buffer ))) { int l = strlen ( buffer ); |