mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 23:37:42 +00:00
conf: storage: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
1030b0aba1
commit
cbe919915e
@ -572,8 +572,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
if (VIR_ALLOC_N(source->hosts, n) < 0)
|
source->hosts = g_new0(virStoragePoolSourceHost, n);
|
||||||
goto cleanup;
|
|
||||||
source->nhost = n;
|
source->nhost = n;
|
||||||
|
|
||||||
for (i = 0; i < source->nhost; i++) {
|
for (i = 0; i < source->nhost; i++) {
|
||||||
@ -703,8 +702,7 @@ virStoragePoolDefParseSourceString(const char *srcSpec,
|
|||||||
&xpath_ctxt)))
|
&xpath_ctxt)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
def = g_new0(virStoragePoolSource, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(node = virXPathNode("/source", xpath_ctxt))) {
|
if (!(node = virXPathNode("/source", xpath_ctxt))) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
@ -814,8 +812,7 @@ virStoragePoolDefRefreshParse(xmlXPathContextPtr ctxt,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(refresh) < 0)
|
refresh = g_new0(virStoragePoolDefRefresh, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
refresh->volume.allocation = tmp;
|
refresh->volume.allocation = tmp;
|
||||||
def->refresh = g_steal_pointer(&refresh);
|
def->refresh = g_steal_pointer(&refresh);
|
||||||
@ -876,8 +873,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
g_autofree char *uuid = NULL;
|
g_autofree char *uuid = NULL;
|
||||||
g_autofree char *target_path = NULL;
|
g_autofree char *target_path = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
def = g_new0(virStoragePoolDef, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
type = virXPathString("string(./@type)", ctxt);
|
type = virXPathString("string(./@type)", ctxt);
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
@ -1324,8 +1320,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
if (options == NULL)
|
if (options == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
def = g_new0(virStorageVolDef, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
def->target.type = VIR_STORAGE_TYPE_FILE;
|
def->target.type = VIR_STORAGE_TYPE_FILE;
|
||||||
|
|
||||||
@ -1370,8 +1365,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(def->target.backingStore->perms) < 0)
|
def->target.backingStore->perms = g_new0(virStoragePerms, 1);
|
||||||
return NULL;
|
|
||||||
if (virStorageDefParsePerms(ctxt, def->target.backingStore->perms,
|
if (virStorageDefParsePerms(ctxt, def->target.backingStore->perms,
|
||||||
"./backingStore/permissions") < 0)
|
"./backingStore/permissions") < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1417,8 +1411,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(def->target.perms) < 0)
|
def->target.perms = g_new0(virStoragePerms, 1);
|
||||||
return NULL;
|
|
||||||
if (virStorageDefParsePerms(ctxt, def->target.perms,
|
if (virStorageDefParsePerms(ctxt, def->target.perms,
|
||||||
"./target/permissions") < 0)
|
"./target/permissions") < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user