[libvirt PATCH 2/8] libxl: libxlDomainStart: autofree managed_save_path

Ján Tomko jtomko at redhat.com
Sun Oct 4 22:21:39 UTC 2020


It is only used once, so it's pointless to free it both in the code
and in the cleanup section.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/libxl/libxl_domain.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index c96aeab04b..034be2ddd7 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1267,7 +1267,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
     int ret = -1;
     uint32_t domid = 0;
     char *dom_xml = NULL;
-    char *managed_save_path = NULL;
+    g_autofree char *managed_save_path = NULL;
     int managed_save_fd = -1;
     libxlDomainObjPrivatePtr priv = vm->privateData;
     g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
@@ -1323,7 +1323,6 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
 
             vm->hasManagedSave = false;
         }
-        VIR_FREE(managed_save_path);
     }
 
     if (virDomainObjSetDefTransient(driver->xmlopt, vm, NULL) < 0)
@@ -1519,7 +1518,6 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
     libxl_domain_config_dispose(&d_config);
     VIR_FREE(config_json);
     VIR_FREE(dom_xml);
-    VIR_FREE(managed_save_path);
     VIR_FORCE_CLOSE(managed_save_fd);
     return ret;
 }
-- 
2.26.2




More information about the libvir-list mailing list