diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 617ccac4a538f8ebefa346b858ce73688292aede..604e006dab3d5ca8133d4c886d0b34bc141df57d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19590,7 +19590,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL;
ssize_t i = 0;
int n;
- int ret = -1;
ctxt->node = node;
@@ -19632,14 +19631,13 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
if (!(resctrl = virDomainResctrlNew(node, alloc, vcpus, flags)))
return -1;
- if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0)
- goto cleanup;
+ if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0) {
+ virDomainResctrlDefFree(resctrl);
+ return -1;
+ }
}
- ret = 0;
- cleanup:
- virDomainResctrlDefFree(resctrl);
- return ret;
+ return 0;
}
diff --git a/tests/genericxml2xmlindata/memorytune.xml b/tests/genericxml2xmlindata/memorytune.xml
index ea03e22fc2b0efdf4c0574eebee5309d58be316e..7486b542c568208d3ee53d4303cec5a8d467d532 100644
--- a/tests/genericxml2xmlindata/memorytune.xml
+++ b/tests/genericxml2xmlindata/memorytune.xml
@@ -5,6 +5,10 @@
219136
4
+
+
+
+