提交 1f2bf483 编写于 作者: M Michal Privoznik

Adapt to VIR_ALLOC and virAsprintf in src/hyperv/*

上级 84c50347
......@@ -117,10 +117,8 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
}
/* Allocate per-connection private data */
if (VIR_ALLOC(priv) < 0) {
virReportOOMError();
if (VIR_ALLOC(priv) < 0)
goto cleanup;
}
if (hypervParseUri(&priv->parsedUri, conn->uri) < 0) {
goto cleanup;
......@@ -802,10 +800,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
/* Flags checked by virDomainDefFormat */
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
if (VIR_ALLOC(def) < 0)
goto cleanup;
}
virUUIDFormat(domain->uuid, uuid_string);
......@@ -1255,9 +1251,8 @@ hypervConnectListAllDomains(virConnectPtr conn,
!MATCH(VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)) ||
(MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) &&
!MATCH(VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT))) {
if (domains &&
VIR_ALLOC_N(*domains, 1) < 0)
goto no_memory;
if (domains && VIR_ALLOC_N(*domains, 1) < 0)
goto cleanup;
ret = 0;
goto cleanup;
......@@ -1287,7 +1282,7 @@ hypervConnectListAllDomains(virConnectPtr conn,
if (domains) {
if (VIR_ALLOC_N(doms, 1) < 0)
goto no_memory;
goto cleanup;
ndoms = 1;
}
......@@ -1326,7 +1321,7 @@ hypervConnectListAllDomains(virConnectPtr conn,
}
if (VIR_RESIZE_N(doms, ndoms, count, 2) < 0)
goto no_memory;
goto cleanup;
domain = NULL;
......@@ -1354,10 +1349,6 @@ cleanup:
hypervFreeObject(priv, (hypervObject *)computerSystemList);
return ret;
no_memory:
virReportOOMError();
goto cleanup;
}
#undef MATCH
......
......@@ -46,10 +46,8 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
return -1;
}
if (VIR_ALLOC(*parsedUri) < 0) {
virReportOOMError();
if (VIR_ALLOC(*parsedUri) < 0)
return -1;
}
for (i = 0; i < uri->paramsCount; i++) {
virURIParamPtr queryParam = &uri->params[i];
......
......@@ -210,10 +210,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
goto cleanup;
}
if (VIR_ALLOC(object) < 0) {
virReportOOMError();
if (VIR_ALLOC(object) < 0)
goto cleanup;
}
object->serializerInfo = serializerInfo;
object->data = data;
......@@ -414,10 +412,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
if (virAsprintf(&selector, "Name=%s&CreationClassName=Msvm_ComputerSystem",
uuid_string) < 0 ||
virAsprintf(&properties, "RequestedState=%d", requestedState) < 0) {
virReportOOMError();
virAsprintf(&properties, "RequestedState=%d", requestedState) < 0)
goto cleanup;
}
options = wsmc_options_init();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册