From 10320ad5264fb6c742d222753aa5a3d23d67f838 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Thu, 26 Sep 2024 10:53:01 +0200 Subject: [PATCH] vbox: Use g_autofree in tryLoadOne() Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_XPCOMCGlue.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c index 688211d122..e625492173 100644 --- a/src/vbox/vbox_XPCOMCGlue.c +++ b/src/vbox/vbox_XPCOMCGlue.c @@ -78,7 +78,7 @@ tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing, unsigned int *version) { int result = -1; - char *name = NULL; + g_autofree char *name = NULL; PFNVBOXGETXPCOMCFUNCTIONS pfnGetFunctions; if (dir != NULL) { @@ -88,7 +88,6 @@ tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing, if (!ignoreMissing) VIR_ERROR(_("Library '%1$s' doesn't exist"), name); - VIR_FREE(name); return -1; } } else { @@ -152,8 +151,6 @@ tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing, g_clear_pointer(&hVBoxXPCOMC, dlclose); } - VIR_FREE(name); - return result; } -- 2.47.2