mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
hyperv: use g_new0 instead of VIR_ALLOC*
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
3f8a30cd7d
commit
535d78630f
@ -128,8 +128,7 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
/* Allocate per-connection private data */
|
/* Allocate per-connection private data */
|
||||||
if (VIR_ALLOC(priv) < 0)
|
priv = g_new0(hypervPrivate, 1);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (hypervParseUri(&priv->parsedUri, conn->uri) < 0)
|
if (hypervParseUri(&priv->parsedUri, conn->uri) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1221,8 +1220,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 && VIR_ALLOC_N(*domains, 1) < 0)
|
if (domains)
|
||||||
goto cleanup;
|
*domains = g_new0(virDomainPtr, 1);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1251,8 +1250,7 @@ hypervConnectListAllDomains(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (domains) {
|
if (domains) {
|
||||||
if (VIR_ALLOC_N(doms, 1) < 0)
|
doms = g_new0(virDomainPtr, 1);
|
||||||
goto cleanup;
|
|
||||||
ndoms = 1;
|
ndoms = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1357,8 +1355,7 @@ hypervDomainSendKey(virDomainPtr domain, unsigned int codeset,
|
|||||||
if (hypervGetMsvmKeyboardList(priv, &query, &keyboard) < 0)
|
if (hypervGetMsvmKeyboardList(priv, &query, &keyboard) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(translatedKeycodes, nkeycodes) < 0)
|
translatedKeycodes = g_new0(int, nkeycodes);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* translate keycodes to win32 and generate keyup scancodes. */
|
/* translate keycodes to win32 and generate keyup scancodes. */
|
||||||
for (i = 0; i < nkeycodes; i++) {
|
for (i = 0; i < nkeycodes; i++) {
|
||||||
|
@ -45,8 +45,7 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(*parsedUri) < 0)
|
*parsedUri = g_new0(hypervParsedUri, 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];
|
||||||
|
@ -176,14 +176,9 @@ hypervCreateInvokeParamsList(hypervPrivate *priv, const char *method,
|
|||||||
if (hypervGetWmiClassInfo(priv, obj, &info) < 0)
|
if (hypervGetWmiClassInfo(priv, obj, &info) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(params) < 0)
|
params = g_new0(hypervInvokeParamsList, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (VIR_ALLOC_N(params->params,
|
params->params = g_new0(hypervParam, HYPERV_DEFAULT_PARAM_COUNT);
|
||||||
HYPERV_DEFAULT_PARAM_COUNT) < 0) {
|
|
||||||
VIR_FREE(params);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
params->method = method;
|
params->method = method;
|
||||||
params->ns = info->rootUri;
|
params->ns = info->rootUri;
|
||||||
@ -1052,9 +1047,7 @@ hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(object) < 0)
|
object = g_new0(hypervObject, 1);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
object->info = wmiInfo;
|
object->info = wmiInfo;
|
||||||
object->data.common = data;
|
object->data.common = data;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user