]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: StateInitialize: use g_autofree
authorJán Tomko <jtomko@redhat.com>
Sat, 22 Feb 2020 12:02:27 +0000 (13:02 +0100)
committerJán Tomko <jtomko@redhat.com>
Tue, 25 Feb 2020 11:05:00 +0000 (12:05 +0100)
Use g_autofree to free the driver config file path.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
src/libxl/libxl_driver.c

index 8f855891d060954f0096aa7b822ecdb2c8990099..5de3bcd2a6379917cce3b8ddbb5f8e1b209418e8 100644 (file)
@@ -653,7 +653,7 @@ libxlStateInitialize(bool privileged,
                      void *opaque)
 {
     libxlDriverConfigPtr cfg;
-    char *driverConf = NULL;
+    g_autofree char *driverConf = NULL;
     char ebuf[1024];
     bool autostart = true;
 
@@ -707,7 +707,6 @@ libxlStateInitialize(bool privileged,
 
     if (libxlDriverConfigLoadFile(cfg, driverConf) < 0)
         goto error;
-    VIR_FREE(driverConf);
 
     /* Register the callbacks providing access to libvirt's event loop */
     libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx);
@@ -823,7 +822,6 @@ libxlStateInitialize(bool privileged,
     return VIR_DRV_STATE_INIT_COMPLETE;
 
  error:
-    VIR_FREE(driverConf);
     libxlStateCleanup();
     return VIR_DRV_STATE_INIT_ERROR;
 }