From 81e91f6a93acb03e36ffdb9a09dc829039f1e8c5 Mon Sep 17 00:00:00 2001 From: Matt Coleman Date: Thu, 5 Nov 2020 22:32:56 -0500 Subject: [PATCH] domain_conf: use g_renew in virDomainDiskInsert() and virDomainControllerInsert() Signed-off-by: Matt Coleman Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cf5b4bf084..ec9e04d2bd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17685,8 +17685,7 @@ virDomainDiskByTarget(virDomainDefPtr def, int virDomainDiskInsert(virDomainDefPtr def, virDomainDiskDefPtr disk) { - if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) - return -1; + def->disks = g_renew(virDomainDiskDefPtr, def->disks, def->ndisks + 1); virDomainDiskInsertPreAlloced(def, disk); @@ -18093,8 +18092,7 @@ virDomainNetARPInterfaces(virDomainDefPtr def, int virDomainControllerInsert(virDomainDefPtr def, virDomainControllerDefPtr controller) { - if (VIR_REALLOC_N(def->controllers, def->ncontrollers+1) < 0) - return -1; + def->controllers = g_renew(virDomainControllerDefPtr, def->controllers, def->ncontrollers + 1); virDomainControllerInsertPreAlloced(def, controller);