From nobody Sun Feb 8 15:42:25 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=1602098577; cv=none; d=zohomail.com; s=zohoarc; b=QIzI06IK/RegzgJ4429lFNStVsFlbbCMHxhEPRg94CeTBGBbPeD5tVmDHcr0X2i1JRKgMa/NEhRxrymqMYsFiSAPgJNw/KcqOg8S6OapjJOkbjgHVNXc/6ETHIGnw3kwyHh4AQWnrWAmYUK+sW9HlwB7TGs3y3dSnOdGw9ZQ6rQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602098577; 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=TyE7a0vFU8VuIc2EYDV5fOhDu1bBx3UyDwlsPZPMNYQ=; b=JYnyw5SBauNlWxL4KQdK0e6um0rtjMK7cLRqWEAH3wSoO0jLALC7ZE3NdI/BcuIgbO/dmkIZWDmZWJmhfKIAMiGjjKeIB31/QB7t8F+97wu9ofGwxfh8p6AMLN6z/E7JKAOD9dU23FWAK0EuOzrqG8LBhUOSc6GflE8X+HFqygI= 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 1602098577065826.7084463155354; Wed, 7 Oct 2020 12:22:57 -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-310-eOnXBRN4PWO4-B8_MwfjWA-1; Wed, 07 Oct 2020 15:22:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1B268070F3; Wed, 7 Oct 2020 19:22:44 +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 84EA076649; Wed, 7 Oct 2020 19:22:44 +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 4FBC58C7AF; Wed, 7 Oct 2020 19:22:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 097JMceh005920 for ; Wed, 7 Oct 2020 15:22:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4D28E100164C; Wed, 7 Oct 2020 19:22:38 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8EAD1001281 for ; Wed, 7 Oct 2020 19:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602098574; 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=TyE7a0vFU8VuIc2EYDV5fOhDu1bBx3UyDwlsPZPMNYQ=; b=h15rofkfxpWB0n2abUUmX49fd0rCImfrfYFEE86grUxDuGpj8GJnXyP27aBzct1q65HrT4 fF6nIQnkNrwXF/VraoroLUXuha/PMI+ppDhUjc52JnSwYvWRfqhMT5MZjkdIOqvhTqbjAI kqVyMkVlR7Vako23uQU0Ns+cYvV19IY= X-MC-Unique: eOnXBRN4PWO4-B8_MwfjWA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/13] conf: domain_addr: use g_new0 Date: Wed, 7 Oct 2020 21:22:21 +0200 Message-Id: <2a74fa19580c88034ccbcb33a1367b6e590ce418.1602098503.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.79 on 10.5.11.11 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/conf/domain_addr.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 9114f2d8d0..ab508b0c8f 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1026,8 +1026,7 @@ virDomainPCIAddressSetExtensionAlloc(virDomainPCIAddr= essSetPtr addrs, if (addrs->zpciIds) return 0; =20 - if (VIR_ALLOC(addrs->zpciIds) < 0) - return -1; + addrs->zpciIds =3D g_new0(virDomainZPCIAddressIds, 1); =20 addrs->zpciIds->uids =3D virHashCreateFull(10, NULL, virZPCIAddrKeyCode, @@ -1054,12 +1053,8 @@ virDomainPCIAddressSetAlloc(unsigned int nbuses, { virDomainPCIAddressSetPtr addrs; =20 - if (VIR_ALLOC(addrs) < 0) - goto error; - - if (VIR_ALLOC_N(addrs->buses, nbuses) < 0) - goto error; - + addrs =3D g_new0(virDomainPCIAddressSet, 1); + addrs->buses =3D g_new0(virDomainPCIAddressBus, nbuses); addrs->nbuses =3D nbuses; =20 if (virDomainPCIAddressSetExtensionAlloc(addrs, extFlags) < 0) @@ -1465,8 +1460,7 @@ virDomainCCWAddressSetCreate(void) { virDomainCCWAddressSetPtr addrs =3D NULL; =20 - if (VIR_ALLOC(addrs) < 0) - goto error; + addrs =3D g_new0(virDomainCCWAddressSet, 1); =20 if (!(addrs->defined =3D virHashCreate(10, virHashValueFree))) goto error; @@ -1520,8 +1514,7 @@ virDomainVirtioSerialAddrSetCreate(void) { virDomainVirtioSerialAddrSetPtr ret =3D NULL; =20 - if (VIR_ALLOC(ret) < 0) - return NULL; + ret =3D g_new0(virDomainVirtioSerialAddrSet, 1); =20 return ret; } @@ -1592,8 +1585,8 @@ virDomainVirtioSerialAddrSetAddController(virDomainVi= rtioSerialAddrSetPtr addrs, VIR_DEBUG("Adding virtio serial controller index %u with %d" " ports to the address set", cont->idx, ports); =20 - if (VIR_ALLOC(cnt) < 0) - goto cleanup; + cnt =3D g_new0(virDomainVirtioSerialController, + 1); =20 cnt->ports =3D virBitmapNew(ports); cnt->idx =3D cont->idx; @@ -1951,8 +1944,7 @@ virDomainUSBAddressSetCreate(void) { virDomainUSBAddressSetPtr addrs; =20 - if (VIR_ALLOC(addrs) < 0) - return NULL; + addrs =3D g_new0(virDomainUSBAddressSet, 1); =20 return addrs; } @@ -2039,17 +2031,14 @@ virDomainUSBAddressHubNew(size_t nports) { virDomainUSBAddressHubPtr hub =3D NULL, ret =3D NULL; =20 - if (VIR_ALLOC(hub) < 0) - goto cleanup; + hub =3D g_new0(virDomainUSBAddressHub, 1); =20 hub->portmap =3D virBitmapNew(nports); =20 - if (VIR_ALLOC_N(hub->ports, nports) < 0) - goto cleanup; + hub->ports =3D g_new0(virDomainUSBAddressHubPtr, nports); hub->nports =3D nports; =20 ret =3D g_steal_pointer(&hub); - cleanup: virDomainUSBAddressHubFree(hub); return ret; } --=20 2.26.2