aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2014-07-15 16:04:25 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2014-07-18 14:57:35 +0200
commitf9e13f8fd87710063f9fa0feaf7de0348b32612a (patch)
tree2e33d37b88ec8fe4b1c81f8e9ddfc671bb44f779 /util
parentf52b7687825ae7b998ce790cd6028ff760b20b4c (diff)
downloadqemu-f9e13f8fd87710063f9fa0feaf7de0348b32612a.zip
qemu-f9e13f8fd87710063f9fa0feaf7de0348b32612a.tar.gz
qemu-f9e13f8fd87710063f9fa0feaf7de0348b32612a.tar.bz2
module: Simplify module_load()
The file path is not used for error reporting, so we can free it directly after use. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/module.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/util/module.c b/util/module.c
index 214effb..9fd3030 100644
--- a/util/module.c
+++ b/util/module.c
@@ -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++) {