domain_conf: use g_renew in virDomainDiskInsert() and virDomainControllerInsert()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Matt Coleman 2020-11-05 22:32:56 -05:00 committed by Michal Privoznik
parent 8f80014299
commit 81e91f6a93

View File

@ -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);