vz: utils: use g_auto for virCommand

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 16:25:43 +01:00
parent 4a56179646
commit 975a2b3555

View File

@ -92,7 +92,7 @@ vzDomObjFromDomain(virDomainPtr domain)
static int static int
vzDoCmdRun(char **outbuf, const char *binary, va_list list) vzDoCmdRun(char **outbuf, const char *binary, va_list list)
{ {
virCommand *cmd = virCommandNewVAList(binary, list); g_autoptr(virCommand) cmd = virCommandNewVAList(binary, list);
int ret = -1; int ret = -1;
if (outbuf) if (outbuf)
@ -104,7 +104,6 @@ vzDoCmdRun(char **outbuf, const char *binary, va_list list)
ret = 0; ret = 0;
cleanup: cleanup:
virCommandFree(cmd);
if (ret && outbuf) if (ret && outbuf)
VIR_FREE(*outbuf); VIR_FREE(*outbuf);
return ret; return ret;