snapshot: simplify OOM checking during parse

* src/conf/snapshot_conf.c (virDomainSnapshotDefParseString):
Simplify OOM reporting.
This commit is contained in:
Eric Blake 2012-10-25 16:26:41 -06:00
parent a3e95abeb5
commit e66bdbb784

View File

@ -208,15 +208,11 @@ virDomainSnapshotDefParseString(const char *xmlStr,
virReportError(VIR_ERR_XML_ERROR, "%s",
_("a redefined snapshot must have a name"));
goto cleanup;
} else {
ignore_value(virAsprintf(&def->name, "%lld",
(long long)tv.tv_sec));
}
}
if (def->name == NULL) {
virReportOOMError();
goto cleanup;
if (virAsprintf(&def->name, "%lld", (long long)tv.tv_sec) < 0) {
virReportOOMError();
goto cleanup;
}
}
def->description = virXPathString("string(./description)", ctxt);