From: Ján Tomko Date: Mon, 13 Dec 2021 18:52:28 +0000 (+0100) Subject: util: use g_auto in virNodeSuspendHelper X-Git-Tag: v8.0.0-rc1~188 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6698d8f5303d5789c1b204046698318bf6342646;p=thirdparty%2Flibvirt.git util: use g_auto in virNodeSuspendHelper Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c index c92232dfe9..e1167605ca 100644 --- a/src/util/virnodesuspend.c +++ b/src/util/virnodesuspend.c @@ -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.