diff --git a/util/module.c b/util/module.c index cbe89fede6..7661d0f623 100644 --- a/util/module.c +++ b/util/module.c @@ -230,10 +230,11 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail) } } - if (!g_hash_table_add(loaded_modules, module_name)) { + if (g_hash_table_contains(loaded_modules, module_name)) { g_free(module_name); return true; } + g_hash_table_add(loaded_modules, module_name); search_dir = getenv("QEMU_MODULE_DIR"); if (search_dir != NULL) {