Skip to content

Commit

Permalink
module: Simplify module_load()
Browse files Browse the repository at this point in the history
The file path is not used for error reporting, so we can free it
directly after use.

Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
afaerber authored and bonzini committed Jul 18, 2014
1 parent f52b768 commit f9e13f8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions util/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,16 @@ static void module_load(module_init_type type)
for (i = 0; i < ARRAY_SIZE(dirs); i++) {
fname = g_strdup_printf("%s/%s%s", dirs[i], *mp, HOST_DSOSUF);
ret = module_load_file(fname);
g_free(fname);
fname = NULL;
/* Try loading until loaded a module file */
if (!ret) {
break;
}
g_free(fname);
fname = NULL;
}
if (ret == -ENOENT) {
fprintf(stderr, "Can't find module: %s\n", *mp);
}

g_free(fname);
}

for (i = 0; i < ARRAY_SIZE(dirs); i++) {
Expand Down

0 comments on commit f9e13f8

Please sign in to comment.