]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vbox: Use g_autofree in tryLoadOne()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 26 Sep 2024 08:53:01 +0000 (10:53 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 31 Jan 2025 09:53:47 +0000 (10:53 +0100)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/vbox/vbox_XPCOMCGlue.c

index 688211d12240b48a65a950bab73cf209d1990e4f..e62549217359290c1fc6af84738e88d6c9dce5e1 100644 (file)
@@ -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;
 }