diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-18 20:41:43 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-18 20:41:43 +0000 |
commit | 69d7bcdf3965a13891493327666bfb7f07c1015f (patch) | |
tree | a6a7bc263bbfc8b61b459051f2084462892f1d24 /modutils/modprobe.c | |
parent | abc284d16e5efc771dc50bbfd5b7428d03c0cd2b (diff) | |
download | busybox-w32-69d7bcdf3965a13891493327666bfb7f07c1015f.tar.gz busybox-w32-69d7bcdf3965a13891493327666bfb7f07c1015f.tar.bz2 busybox-w32-69d7bcdf3965a13891493327666bfb7f07c1015f.zip |
Avoid a memory leak pointed out by Lucas C. Villa Real.
git-svn-id: svn://busybox.net/trunk/busybox@15107 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'modutils/modprobe.c')
-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 2925dd28d..3f68d64ea 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -388,15 +388,14 @@ static struct dep_t *build_dep ( void ) | |||
388 | } | 388 | } |
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 | 391 | fd = open ( filename, O_RDONLY ); | |
392 | if (( fd = open ( filename, O_RDONLY )) < 0 ) { | 392 | if (ENABLE_FEATURE_CLEAN_UP) free(filename); |
393 | 393 | if (fd < 0) { | |
394 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ | 394 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ |
395 | if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) { | 395 | if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) { |
396 | return 0; | 396 | return 0; |
397 | } | 397 | } |
398 | } | 398 | } |
399 | free(filename); | ||
400 | 399 | ||
401 | while ( reads ( fd, buffer, sizeof( buffer ))) { | 400 | while ( reads ( fd, buffer, sizeof( buffer ))) { |
402 | int l = strlen ( buffer ); | 401 | int l = strlen ( buffer ); |