This refactor allows to add some code between virDomainResctrlNew
and virResctrlAllocIsEmpty to extend the scope of resctrl.
Signed-off-by: Wang Huaqiang <huaqiang.wang(a)intel.com>
---
src/conf/domain_conf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 39bd396..a068d4d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19022,15 +19022,15 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
goto cleanup;
}
+ resctrl = virDomainResctrlNew(node, &alloc, &vcpus, flags);
+ if (!resctrl)
+ goto cleanup;
+
if (virResctrlAllocIsEmpty(alloc)) {
ret = 0;
goto cleanup;
}
- resctrl = virDomainResctrlNew(node, &alloc, &vcpus, flags);
- if (!resctrl)
- goto cleanup;
-
if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0)
goto cleanup;
--
2.7.4