From nobody Sun Feb 8 18:32:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601894261; cv=none; d=zohomail.com; s=zohoarc; b=VT2T51wySAbwJKYWH4dCQlqD95cjgVVIbIHfado3Tg8fEOJa4CIiBSeBVxdQa1uuwOsbuxU33lvgfnbiGxom85lrig+z0mvKm4HDLqxM0ntr5TkUBbqAfb9ycsdVfyQGiBtAwL2AsvE1qQufs0DcfDlM8xv57z2PJ9Ce16i45t0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601894261; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Vc24kr/PC9jBGbN2fFOgOsT2Av0Dl8kni1hsi+PNyeA=; b=RgL+eZr8w4OXLsj8PqkM2iU7uiaGo5N4FumWxc1VUtw5VZGf8DvP9zCGmPDBo/s6PI261KUiVqIGCLMHNk1dDciXJYIx4bOTgY/4RV8tPWrOPRvKrgPfczlyD+kQZjSt7Pu4WrxWM3gTmkCQuAnljVLhVwN+Ov9omVd1WZuV5z0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1601894261434695.4474420636219; Mon, 5 Oct 2020 03:37:41 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-xo7B-itQMRSTXQAxrt9E4g-1; Mon, 05 Oct 2020 06:37:37 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E1574186840B; Mon, 5 Oct 2020 10:37:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8C87271A3; Mon, 5 Oct 2020 10:37:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 883FC44A69; Mon, 5 Oct 2020 10:37:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 095AatL2018955 for ; Mon, 5 Oct 2020 06:36:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id E2EA95C22B; Mon, 5 Oct 2020 10:36:55 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 447F55C1BD for ; Mon, 5 Oct 2020 10:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601894260; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Vc24kr/PC9jBGbN2fFOgOsT2Av0Dl8kni1hsi+PNyeA=; b=cek9vWXKu6sMyQAGS5HAVjHgOSvyJnBBFMH8PRRD53tqa6sGOtZmhgpE/TO2xscCSmWGlZ dssK831Iy66CIEzI5fGVDJ/UsZpPpBO2F1DMquVZWlBOcW+0W25hnO1R8QXAemOFJKf6VC eGZVVYwnrmc2qoeOZt6YucmNa90C4Mg= X-MC-Unique: xo7B-itQMRSTXQAxrt9E4g-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 9/9] qemu: use g_new0 Date: Mon, 5 Oct 2020 12:36:39 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_agent.c | 6 ++---- src/qemu/qemu_block.c | 15 +++++---------- src/qemu/qemu_cgroup.c | 6 ++---- src/qemu/qemu_conf.c | 20 ++++++++------------ src/qemu/qemu_domain_address.c | 3 +-- src/qemu/qemu_hotplug.c | 29 +++++++++++------------------ src/qemu/qemu_migration.c | 6 ++---- src/qemu/qemu_monitor.c | 13 +++---------- src/qemu/qemu_namespace.c | 3 +-- src/qemu/qemu_saveimage.c | 3 +-- src/qemu/qemu_vhost_user.c | 17 +++++++---------- 11 files changed, 43 insertions(+), 78 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 1239aceb46..09116e749c 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1452,8 +1452,7 @@ qemuAgentGetVCPUs(qemuAgentPtr agent, =20 ndata =3D virJSONValueArraySize(data); =20 - if (VIR_ALLOC_N(*info, ndata) < 0) - goto cleanup; + *info =3D g_new0(qemuAgentCPUInfo, ndata); =20 for (i =3D 0; i < ndata; i++) { virJSONValuePtr entry =3D virJSONValueArrayGet(data, i); @@ -2148,8 +2147,7 @@ qemuAgentGetInterfaces(qemuAgentPtr agent, if (VIR_EXPAND_N(ifaces_ret, ifaces_count, 1) < 0) goto error; =20 - if (VIR_ALLOC(ifaces_ret[ifaces_count - 1]) < 0) - goto error; + ifaces_ret[ifaces_count - 1] =3D g_new0(virDomainInterface, 1); =20 if (virHashAddEntry(ifaces_store, ifname_s, ifaces_ret[ifaces_count - 1]) < 0) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 487b0a72e7..6bea21347a 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -169,8 +169,7 @@ qemuBlockNodeNameGetBackingChainBacking(virJSONValuePtr= next, } } =20 - if (VIR_ALLOC(data) < 0) - return -1; + data =3D g_new0(qemuBlockNodeNameBackingChainData, 1); =20 data->nodeformat =3D g_strdup(nodename); data->nodestorage =3D g_strdup(parentnodename); @@ -415,8 +414,7 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src) return NULL; } =20 - if (VIR_ALLOC(uri) < 0) - return NULL; + uri =3D g_new0(virURI, 1); =20 if (src->hosts->transport =3D=3D VIR_STORAGE_NET_HOST_TRANS_TCP) { uri->port =3D src->hosts->port; @@ -1595,8 +1593,7 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorag= eSourcePtr src, if (autoreadonly) backendpropsflags |=3D QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUT= O_READONLY; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(qemuBlockStorageSourceAttachData, 1); =20 if (!(data->formatProps =3D qemuBlockStorageSourceGetBlockdevProps(src, backi= ngStore)) || @@ -1886,8 +1883,7 @@ qemuBlockStorageSourceChainDetachPrepareBlockdev(virS= torageSourcePtr src) g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; virStorageSourcePtr n; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(qemuBlockStorageSourceChainData, 1); =20 for (n =3D src; virStorageSourceIsBacking(n); n =3D n->backingStore) { if (!(backend =3D qemuBlockStorageSourceDetachPrepare(n, NULL))) @@ -1916,8 +1912,7 @@ qemuBlockStorageSourceChainDetachPrepareDrive(virStor= ageSourcePtr src, g_autoptr(qemuBlockStorageSourceAttachData) backend =3D NULL; g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(qemuBlockStorageSourceChainData, 1); =20 if (!(backend =3D qemuBlockStorageSourceDetachPrepare(src, driveAlias)= )) return NULL; diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index e88da02341..b671991ad6 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -926,8 +926,7 @@ qemuInitCgroup(virDomainObjPtr vm, if (!vm->def->resource) { virDomainResourceDefPtr res; =20 - if (VIR_ALLOC(res) < 0) - return -1; + res =3D g_new0(virDomainResourceDef, 1); =20 res->partition =3D g_strdup("/machine"); =20 @@ -1252,8 +1251,7 @@ qemuCgroupEmulatorAllNodesAllow(virCgroupPtr cgroup, if (!(all_nodes_str =3D virBitmapFormat(all_nodes))) goto cleanup; =20 - if (VIR_ALLOC(data) < 0) - goto cleanup; + data =3D g_new0(qemuCgroupEmulatorAllNodesData, 1); =20 if (virCgroupNewThread(cgroup, VIR_CGROUP_THREAD_EMULATOR, 0, false, &data->emulatorCgroup) < 0) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index f4ed1fa061..6d16c11017 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -641,9 +641,8 @@ virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfig= Ptr cfg, VIR_FREE(cfg->hugetlbfs); =20 cfg->nhugetlbfs =3D virStringListLength((const char *const *)huget= lbfs); - if (hugetlbfs[0] && - VIR_ALLOC_N(cfg->hugetlbfs, cfg->nhugetlbfs) < 0) - return -1; + if (hugetlbfs[0]) + cfg->hugetlbfs =3D g_new0(virHugeTLBFS, cfg->nhugetlbfs); =20 for (i =3D 0; hugetlbfs[i] !=3D NULL; i++) { if (virQEMUDriverConfigHugeTLBFSInit(&cfg->hugetlbfs[i], @@ -840,12 +839,11 @@ virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfig= Ptr cfg, } =20 cfg->nfirmwares =3D virStringListLength((const char *const *)nvram= ); - if (nvram[0] && VIR_ALLOC_N(cfg->firmwares, cfg->nfirmwares) < 0) - return -1; + if (nvram[0]) + cfg->firmwares =3D g_new0(virFirmwarePtr, cfg->nfirmwares); =20 for (i =3D 0; nvram[i] !=3D NULL; i++) { - if (VIR_ALLOC(cfg->firmwares[i]) < 0) - return -1; + cfg->firmwares[i] =3D g_new0(virFirmware, 1); if (virFirmwareParse(nvram[i], cfg->firmwares[i]) < 0) return -1; } @@ -1349,8 +1347,7 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDri= verPtr driver) ; caps->host.nsecModels =3D i; =20 - if (VIR_ALLOC_N(caps->host.secModels, caps->host.nsecModels) < 0) - return NULL; + caps->host.secModels =3D g_new0(virCapsHostSecModel, caps->host.nsecMo= dels); =20 for (i =3D 0; sec_managers[i]; i++) { virCapsHostSecModelPtr sm =3D &caps->host.secModels[i]; @@ -1616,9 +1613,8 @@ qemuSharedDeviceEntryInsert(virQEMUDriverPtr driver, entry->domains[entry->ref - 1] =3D g_strdup(name); } } else { - if (VIR_ALLOC(entry) < 0 || - VIR_ALLOC_N(entry->domains, 1) < 0) - goto error; + entry =3D g_new0(qemuSharedDeviceEntry, 1); + entry->domains =3D g_new0(char *, 1); =20 entry->domains[0] =3D g_strdup(name); =20 diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 61eb53ea2c..0199a620a0 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -3038,8 +3038,7 @@ qemuDomainUSBAddressAddHubs(virDomainDefPtr def) data.count, available_ports, hubs_needed); =20 for (i =3D 0; i < hubs_needed; i++) { - if (VIR_ALLOC(hub) < 0) - return -1; + hub =3D g_new0(virDomainHubDef, 1); hub->type =3D VIR_DOMAIN_HUB_TYPE_USB; =20 if (VIR_APPEND_ELEMENT(def->hubs, def->nhubs, hub) < 0) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 11b549b12b..09f8525cfa 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -928,8 +928,7 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverP= tr driver, =20 /* No SCSI controller present, for backward compatibility we * now hotplug a controller */ - if (VIR_ALLOC(cont) < 0) - return NULL; + cont =3D g_new0(virDomainControllerDef, 1); cont->type =3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI; cont->idx =3D controller; if (model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT) @@ -1243,11 +1242,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize =3D vhostfdSize =3D 1; queueSize =3D tapfdSize; - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0) - goto cleanup; + tapfd =3D g_new0(int, tapfdSize); memset(tapfd, -1, sizeof(*tapfd) * tapfdSize); - if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0) - goto cleanup; + vhostfd =3D g_new0(int, vhostfdSize); memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceBridgeConnect(vm->def, driver, net, tapfd, &tapfdSize) < 0) @@ -1262,11 +1259,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize =3D vhostfdSize =3D 1; queueSize =3D tapfdSize; - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0) - goto cleanup; + tapfd =3D g_new0(int, tapfdSize); memset(tapfd, -1, sizeof(*tapfd) * tapfdSize); - if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0) - goto cleanup; + vhostfd =3D g_new0(int, vhostfdSize); memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceDirectConnect(vm->def, driver, net, tapfd, tapfdSize, @@ -1282,10 +1277,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!tapfdSize) tapfdSize =3D vhostfdSize =3D 1; queueSize =3D tapfdSize; - if (VIR_ALLOC_N(tapfd, tapfdSize) < 0) - goto cleanup; + tapfd =3D g_new0(int, tapfdSize); memset(tapfd, -1, sizeof(*tapfd) * tapfdSize); - if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0) + vhostfd =3D g_new0(int, vhostfdSize); goto cleanup; memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceEthernetConnect(vm->def, driver, net, @@ -1381,9 +1375,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, goto cleanup; } =20 - if (VIR_ALLOC_N(tapfdName, tapfdSize) < 0 || - VIR_ALLOC_N(vhostfdName, vhostfdSize) < 0) - goto cleanup; + tapfdName =3D g_new0(char *, tapfdSize); + vhostfdName =3D g_new0(char *, vhostfdSize); =20 for (i =3D 0; i < tapfdSize; i++) tapfdName[i] =3D g_strdup_printf("fd-%s%zu", net->info.alias, i); @@ -1973,8 +1966,8 @@ qemuDomainChrPreInsert(virDomainDefPtr vmdef, */ if (vmdef->nserials =3D=3D 0 && vmdef->nconsoles =3D=3D 0 && chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { - if (!vmdef->consoles && VIR_ALLOC(vmdef->consoles) < 0) - return -1; + if (!vmdef->consoles) + vmdef->consoles =3D g_new0(virDomainChrDefPtr, 1); =20 /* We'll be dealing with serials[0] directly, so NULL is fine here= . */ if (!(vmdef->consoles[0] =3D virDomainChrDefNew(NULL))) { diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 403f5d3e13..2000c86640 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3309,8 +3309,7 @@ static void qemuMigrationSrcIOFunc(void *arg) VIR_DEBUG("Running migration tunnel; stream=3D%p, sock=3D%d", data->st, data->sock); =20 - if (VIR_ALLOC_N(buffer, TUNNEL_SEND_BUF_SIZE) < 0) - goto abrt; + buffer =3D g_new0(char, TUNNEL_SEND_BUF_SIZE); =20 fds[0].fd =3D data->sock; fds[1].fd =3D data->wakeupRecvFD; @@ -3414,8 +3413,7 @@ qemuMigrationSrcStartTunnel(virStreamPtr st, if (virPipe(wakeupFD) < 0) goto error; =20 - if (VIR_ALLOC(io) < 0) - goto error; + io =3D g_new0(qemuMigrationIOThread, 1); =20 io->st =3D st; io->sock =3D sock; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index eb4b04dc1a..27ad739983 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1869,8 +1869,7 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon, =20 QEMU_CHECK_MONITOR(mon); =20 - if (VIR_ALLOC_N(info, maxvcpus) < 0) - return -1; + info =3D g_new0(qemuMonitorCPUInfo, maxvcpus); =20 /* initialize a few non-zero defaults */ qemuMonitorCPUInfoClear(info, maxvcpus); @@ -3685,11 +3684,9 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUMode= lInfo *orig) qemuMonitorCPUModelInfoPtr copy; size_t i; =20 - if (VIR_ALLOC(copy) < 0) - goto error; + copy =3D g_new0(qemuMonitorCPUModelInfo, 1); =20 - if (VIR_ALLOC_N(copy->props, orig->nprops) < 0) - goto error; + copy->props =3D g_new0(qemuMonitorCPUProperty, orig->nprops); =20 copy->name =3D g_strdup(orig->name); =20 @@ -3720,10 +3717,6 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUMode= lInfo *orig) } =20 return copy; - - error: - qemuMonitorCPUModelInfoFree(copy); - return NULL; } =20 =20 diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index b0d1d0d083..5c58893693 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -155,8 +155,7 @@ qemuDomainGetPreservedMounts(virQEMUDriverConfigPtr cfg, } } =20 - if (VIR_ALLOC_N(paths, nmounts) < 0) - goto error; + paths =3D g_new0(char *, nmounts); =20 for (i =3D 0; i < nmounts; i++) { if (!(paths[i] =3D qemuDomainGetPreservedMountPath(cfg, vm, mounts= [i]))) diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index 52468056ad..0e588d463d 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -103,8 +103,7 @@ virQEMUSaveDataNew(char *domXML, virQEMUSaveDataPtr data =3D NULL; virQEMUSaveHeaderPtr header; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(virQEMUSaveData, 1); =20 data->xml =3D g_steal_pointer(&domXML); =20 diff --git a/src/qemu/qemu_vhost_user.c b/src/qemu/qemu_vhost_user.c index be7c3dd5b8..260f3cd550 100644 --- a/src/qemu/qemu_vhost_user.c +++ b/src/qemu/qemu_vhost_user.c @@ -196,8 +196,7 @@ qemuVhostUserParse(const char *path) return NULL; } =20 - if (VIR_ALLOC(vu) < 0) - return NULL; + vu =3D g_new0(qemuVhostUser, 1); =20 if (qemuVhostUserTypeParse(path, doc, vu) < 0) return NULL; @@ -253,8 +252,7 @@ qemuVhostUserFetchParsedConfigs(bool privileged, =20 npaths =3D virStringListLength((const char **)paths); =20 - if (VIR_ALLOC_N(vus, npaths) < 0) - return -1; + vus =3D g_new0(qemuVhostUserPtr, npaths); =20 for (i =3D 0; i < npaths; i++) { if (!(vus[i] =3D qemuVhostUserParse(paths[i]))) @@ -292,8 +290,7 @@ qemuVhostUserGPUFillCapabilities(qemuVhostUserPtr vu, } =20 nfeatures =3D virJSONValueArraySize(featuresJSON); - if (VIR_ALLOC_N(features, nfeatures) < 0) - return -1; + features =3D g_new0(qemuVhostUserGPUFeature, nfeatures); =20 for (i =3D 0; i < nfeatures; i++) { virJSONValuePtr item =3D virJSONValueArrayGet(featuresJSON, i); @@ -382,8 +379,8 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver, continue; } =20 - if (!video->driver && VIR_ALLOC(video->driver) < 0) - goto end; + if (!video->driver) + video->driver =3D g_new0(virDomainVideoDriverDef, 1); =20 VIR_FREE(video->driver->vhost_user_binary); video->driver->vhost_user_binary =3D g_strdup(vu->binary); @@ -397,8 +394,8 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver, goto end; } =20 - if (!video->accel && VIR_ALLOC(video->accel) < 0) - goto end; + if (!video->accel) + video->accel =3D g_new0(virDomainVideoAccelDef, 1); =20 if (!video->accel->rendernode && qemuVhostUserGPUHasFeature(&vu->capabilities.gpu, --=20 2.26.2