util: use g_auto in virNodeSuspendHelper

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2021-12-13 19:52:28 +01:00
parent 00a565aa78
commit 6698d8f530

View 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.