Avoid a memory leak pointed out by Lucas C. Villa Real.
This commit is contained in:
parent
d2ccc2ba26
commit
3afb070e6d
@ -388,15 +388,14 @@ static struct dep_t *build_dep ( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release );
|
filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release );
|
||||||
|
fd = open ( filename, O_RDONLY );
|
||||||
if (( fd = open ( filename, O_RDONLY )) < 0 ) {
|
if (ENABLE_FEATURE_CLEAN_UP) free(filename);
|
||||||
|
if (fd < 0) {
|
||||||
/* Ok, that didn't work. Fall back to looking in /lib/modules */
|
/* Ok, that didn't work. Fall back to looking in /lib/modules */
|
||||||
if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) {
|
if (( fd = open ( "/lib/modules/modules.dep", O_RDONLY )) < 0 ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(filename);
|
|
||||||
|
|
||||||
while ( reads ( fd, buffer, sizeof( buffer ))) {
|
while ( reads ( fd, buffer, sizeof( buffer ))) {
|
||||||
int l = strlen ( buffer );
|
int l = strlen ( buffer );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user