[PATCH 2/9] virDomainDiskAddISCSIPoolSourceHost: use g_new0 instead of VIR_ALLOC_N

Peter Krempa pkrempa at redhat.com
Wed Feb 5 13:40:53 UTC 2020


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/domain_conf.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6124c7520c..7cf555596f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31339,9 +31339,7 @@ virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def,

     /* iscsi pool only supports one host */
     def->src->nhosts = 1;
-
-    if (VIR_ALLOC_N(def->src->hosts, def->src->nhosts) < 0)
-        goto cleanup;
+    def->src->hosts = g_new0(virStorageNetHostDef, 1);

     def->src->hosts[0].name = g_strdup(pooldef->source.hosts[0].name);

-- 
2.24.1




More information about the libvir-list mailing list