utils/module: fix memleak in module_load()

Memory for version_dir, allocated by g_strdup, is not freed

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260630110601.736019-1-frolov@swemel.ru>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
This commit is contained in:
Dmitry Frolov
2026-06-30 14:06:02 +03:00
committed by Philippe Mathieu-Daudé
parent 0e51b71c7b
commit cc4fe73fba

View File

@@ -203,7 +203,7 @@ int module_load(const char *prefix, const char *name, Error **errp)
{
int rv = -1;
#ifdef CONFIG_MODULE_UPGRADES
char *version_dir;
g_autofree char *version_dir = NULL;
#endif
const char *search_dir;
char *dirs[5];