From f9e13f8fd87710063f9fa0feaf7de0348b32612a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 15 Jul 2014 16:04:25 +0200 Subject: [PATCH] module: Simplify module_load() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The file path is not used for error reporting, so we can free it directly after use. Reviewed-by: Fam Zheng Signed-off-by: Andreas Färber Signed-off-by: Paolo Bonzini --- util/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/util/module.c b/util/module.c index 214effb39f..9fd30309ae 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++) {