mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 18:05:20 +00:00
Adapt to VIR_ALLOC and virAsprintf in src/hyperv/*
This commit is contained in:
parent
84c50347e0
commit
1f2bf4833b
@ -117,10 +117,8 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate per-connection private data */
|
/* Allocate per-connection private data */
|
||||||
if (VIR_ALLOC(priv) < 0) {
|
if (VIR_ALLOC(priv) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (hypervParseUri(&priv->parsedUri, conn->uri) < 0) {
|
if (hypervParseUri(&priv->parsedUri, conn->uri) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -802,10 +800,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
|||||||
|
|
||||||
/* Flags checked by virDomainDefFormat */
|
/* Flags checked by virDomainDefFormat */
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0) {
|
if (VIR_ALLOC(def) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
virUUIDFormat(domain->uuid, uuid_string);
|
virUUIDFormat(domain->uuid, uuid_string);
|
||||||
|
|
||||||
@ -1255,9 +1251,8 @@ hypervConnectListAllDomains(virConnectPtr conn,
|
|||||||
!MATCH(VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)) ||
|
!MATCH(VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)) ||
|
||||||
(MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) &&
|
(MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) &&
|
||||||
!MATCH(VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT))) {
|
!MATCH(VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT))) {
|
||||||
if (domains &&
|
if (domains && VIR_ALLOC_N(*domains, 1) < 0)
|
||||||
VIR_ALLOC_N(*domains, 1) < 0)
|
goto cleanup;
|
||||||
goto no_memory;
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1287,7 +1282,7 @@ hypervConnectListAllDomains(virConnectPtr conn,
|
|||||||
|
|
||||||
if (domains) {
|
if (domains) {
|
||||||
if (VIR_ALLOC_N(doms, 1) < 0)
|
if (VIR_ALLOC_N(doms, 1) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
ndoms = 1;
|
ndoms = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1326,7 +1321,7 @@ hypervConnectListAllDomains(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_RESIZE_N(doms, ndoms, count, 2) < 0)
|
if (VIR_RESIZE_N(doms, ndoms, count, 2) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
|
|
||||||
domain = NULL;
|
domain = NULL;
|
||||||
|
|
||||||
@ -1354,10 +1349,6 @@ cleanup:
|
|||||||
hypervFreeObject(priv, (hypervObject *)computerSystemList);
|
hypervFreeObject(priv, (hypervObject *)computerSystemList);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
#undef MATCH
|
#undef MATCH
|
||||||
|
|
||||||
|
@ -46,10 +46,8 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(*parsedUri) < 0) {
|
if (VIR_ALLOC(*parsedUri) < 0)
|
||||||
virReportOOMError();
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < uri->paramsCount; i++) {
|
for (i = 0; i < uri->paramsCount; i++) {
|
||||||
virURIParamPtr queryParam = &uri->params[i];
|
virURIParamPtr queryParam = &uri->params[i];
|
||||||
|
@ -210,10 +210,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(object) < 0) {
|
if (VIR_ALLOC(object) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
object->serializerInfo = serializerInfo;
|
object->serializerInfo = serializerInfo;
|
||||||
object->data = data;
|
object->data = data;
|
||||||
@ -414,10 +412,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
|
|||||||
|
|
||||||
if (virAsprintf(&selector, "Name=%s&CreationClassName=Msvm_ComputerSystem",
|
if (virAsprintf(&selector, "Name=%s&CreationClassName=Msvm_ComputerSystem",
|
||||||
uuid_string) < 0 ||
|
uuid_string) < 0 ||
|
||||||
virAsprintf(&properties, "RequestedState=%d", requestedState) < 0) {
|
virAsprintf(&properties, "RequestedState=%d", requestedState) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
options = wsmc_options_init();
|
options = wsmc_options_init();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user