Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/openvz/openvz_driver.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index ce3262c0e2..efd334a235 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -118,15 +118,14 @@ openvzDomObjFromDomain(struct openvz_driver *driver,
static virCommand *
openvzDomainDefineCmd(virDomainDef *vmdef)
{
- virCommand *cmd = virCommandNewArgList(VZCTL,
- "--quiet",
- "create",
- NULL);
+ g_autoptr(virCommand) cmd = virCommandNewArgList(VZCTL,
+ "--quiet",
+ "create",
+ NULL);
if (vmdef == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Container is not defined"));
- virCommandFree(cmd);
return NULL;
}
@@ -137,7 +136,7 @@ openvzDomainDefineCmd(virDomainDef *vmdef)
virCommandAddArgList(cmd, "--ostemplate", vmdef->fss[0]->src,
NULL);
}
- return cmd;
+ return g_steal_pointer(&cmd);
}
--
2.31.1