- cleanup memory if opening aliases failed and cleanup was requested.
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Fri, 19 May 2006 11:25:30 +0000 (11:25 -0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Fri, 19 May 2006 11:25:30 +0000 (11:25 -0000)
(r15107 from trunk)

modutils/modprobe.c

index c16151537eca1ea9df273a17a06ab20a5126384e..08dc0e06abcc6162bf0d24e6f13e080b42df137c 100644 (file)
@@ -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 );