From: Bernhard Reutner-Fischer Date: Fri, 19 May 2006 11:25:30 +0000 (-0000) Subject: - cleanup memory if opening aliases failed and cleanup was requested. X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7107a2f38c5a675d484db2d0bc75d713ae1d9fc2;p=oweals%2Fbusybox.git - cleanup memory if opening aliases failed and cleanup was requested. (r15107 from trunk) --- diff --git a/modutils/modprobe.c b/modutils/modprobe.c index c16151537..08dc0e06a 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -290,15 +290,15 @@ 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 = bb_strlen ( buffer );