diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index d39b60e0af..f7630dd200 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -823,7 +823,6 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, goto cleanup; } - ret = 0; for (i = 0; i < *nparams; i++) { virMemoryParameterPtr param = ¶ms[i]; val = 0; @@ -836,14 +835,12 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, if (rc != 0) { virReportSystemError(-rc, "%s", _("unable to get memory hard limit")); - ret = -1; - continue; + goto cleanup; } if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_HARD_LIMIT) == NULL) { lxcError(VIR_ERR_INTERNAL_ERROR, "%s", _("Field memory hard limit too long for destination")); - ret = -1; - continue; + goto cleanup; } param->value.ul = val; break; @@ -853,14 +850,12 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, if (rc != 0) { virReportSystemError(-rc, "%s", _("unable to get memory soft limit")); - ret = -1; - continue; + goto cleanup; } if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_SOFT_LIMIT) == NULL) { lxcError(VIR_ERR_INTERNAL_ERROR, "%s", _("Field memory soft limit too long for destination")); - ret = -1; - continue; + goto cleanup; } param->value.ul = val; break; @@ -870,14 +865,12 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, if (rc != 0) { virReportSystemError(-rc, "%s", _("unable to get swap hard limit")); - ret = -1; - continue; + goto cleanup; } if (virStrcpyStatic(param->field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT) == NULL) { lxcError(VIR_ERR_INTERNAL_ERROR, "%s", _("Field swap hard limit too long for destination")); - ret = -1; - continue; + goto cleanup; } param->value.ul = val; break; @@ -888,6 +881,8 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, } } + ret = 0; + cleanup: if (cgroup) virCgroupFree(&cgroup);