]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: use g_auto in virNodeSuspendHelper
authorJán Tomko <jtomko@redhat.com>
Mon, 13 Dec 2021 18:52:28 +0000 (19:52 +0100)
committerJán Tomko <jtomko@redhat.com>
Tue, 14 Dec 2021 15:41:36 +0000 (16:41 +0100)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virnodesuspend.c

index c92232dfe96e068522c7c2b376930c4cb86dd92d..e1167605ca001e4ad175a52f75f680ad0326cd86 100644 (file)
@@ -102,7 +102,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime)
  */
 static void virNodeSuspendHelper(void *cmdString)
 {
-    virCommand *suspendCmd = virCommandNew((const char *)cmdString);
+    g_autoptr(virCommand) suspendCmd = virCommandNew((const char *)cmdString);
 
     /*
      * Delay for sometime so that the function virNodeSuspend()
@@ -112,8 +112,6 @@ static void virNodeSuspendHelper(void *cmdString)
     if (virCommandRun(suspendCmd, NULL) < 0)
         VIR_WARN("Failed to suspend the host");
 
-    virCommandFree(suspendCmd);
-
     /*
      * Now that we have resumed from suspend or the suspend failed,
      * reset 'aboutToSuspend' flag.