Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/openvz/openvz_driver.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 345c31304a..3cd655e5a7 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1551,28 +1551,22 @@ openvzDomainSetBarrierLimit(virDomainPtr domain, unsigned long long barrier, unsigned long long limit) { - int ret = -1; - virCommand *cmd = virCommandNewArgList(VZCTL, "--quiet", "set", NULL); + g_autoptr(virCommand) cmd = virCommandNewArgList(VZCTL, "--quiet", "set", NULL); /* LONG_MAX indicates unlimited so reject larger values */ if (barrier > LONG_MAX || limit > LONG_MAX) { virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to set %s for %s: value too large"), param, domain->name); - goto cleanup; + return -1; } virCommandAddArg(cmd, domain->name); virCommandAddArgFormat(cmd, "--%s", param); virCommandAddArgFormat(cmd, "%llu:%llu", barrier, limit); virCommandAddArg(cmd, "--save"); - if (virCommandRun(cmd, NULL) < 0) - goto cleanup; - ret = 0; - cleanup: - virCommandFree(cmd); - return ret; + return virCommandRun(cmd, NULL); } -- 2.31.1