From nobody Sun Feb 8 18:35:23 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=ATwN9S2xZbngVAkbnBuXpTWkvBEcQT+p4oDmev+Uh1t9YDtYnAzyez40BSkj8XOKdHP2aN4BA5NKa+H0vxujBhYZsI005iHY2D6FuVpQ5foZJE792nigeMazLhiaAgwe0MkpjYyw9exh55VZJPRY9wY14nUvvP8gm7+R0n39CoU= 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=tLfN0A6VLSVjwoEfOlQwshyfEkPcmFIpbljMB2jbDHA=; b=Whhu353Rlpwx59383cqqZ/TqqtZAg5oQ23irp8jpj6vEiccQdK11FmwCKXh0lz0q0Q6pyXz++Emml/Kcue2BhPRTMjgBpJLJeic1W8lrAEhG/HyAFpNZAsGfhQQGdg0TGMdaUk/XXC4Rai3M+3SdPV0qH4IklJl2esGMLlQ2eFQ= 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 1602098577316139.67870375920245; 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-378-Arstv4xaN6WduiXQsNiLbA-1; Wed, 07 Oct 2020 15:22:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 586E31019633; Wed, 7 Oct 2020 19:22:45 +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 36F9A60E1C; Wed, 7 Oct 2020 19:22:45 +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 04A4D8C7B2; Wed, 7 Oct 2020 19:22:45 +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 097JMeaO005951 for ; Wed, 7 Oct 2020 15:22:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id B7C041001281; Wed, 7 Oct 2020 19:22:40 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FA9F100164C for ; Wed, 7 Oct 2020 19:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602098575; 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=tLfN0A6VLSVjwoEfOlQwshyfEkPcmFIpbljMB2jbDHA=; b=a3+yp8ncmWMfsEA1puWUFTK2U2C0zGXRhSoDgCw6/CyXylZH+lNBQ8CvAtvDXI3eFYvLLV WY28+B9Uoq16CH1td7IUXHTLB2dpcXmsf6db3WNKFKWFzslfxj1PPXbpo9LZlBSou4IT1X XeVY8k3/cG8jVt6a05wSRF6zxqPUgQc= X-MC-Unique: Arstv4xaN6WduiXQsNiLbA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 08/13] conf: storage: use g_new0 Date: Wed, 7 Oct 2020 21:22:24 +0200 Message-Id: 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.12 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/storage_conf.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index ae63cc725e..09769e6c79 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -572,8 +572,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, goto cleanup; =20 if (n) { - if (VIR_ALLOC_N(source->hosts, n) < 0) - goto cleanup; + source->hosts =3D g_new0(virStoragePoolSourceHost, n); source->nhost =3D n; =20 for (i =3D 0; i < source->nhost; i++) { @@ -703,8 +702,7 @@ virStoragePoolDefParseSourceString(const char *srcSpec, &xpath_ctxt))) return NULL; =20 - if (VIR_ALLOC(def) < 0) - return NULL; + def =3D g_new0(virStoragePoolSource, 1); =20 if (!(node =3D virXPathNode("/source", xpath_ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -814,8 +812,7 @@ virStoragePoolDefRefreshParse(xmlXPathContextPtr ctxt, return -1; } =20 - if (VIR_ALLOC(refresh) < 0) - return -1; + refresh =3D g_new0(virStoragePoolDefRefresh, 1); =20 refresh->volume.allocation =3D tmp; def->refresh =3D g_steal_pointer(&refresh); @@ -876,8 +873,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) g_autofree char *uuid =3D NULL; g_autofree char *target_path =3D NULL; =20 - if (VIR_ALLOC(def) < 0) - return NULL; + def =3D g_new0(virStoragePoolDef, 1); =20 type =3D virXPathString("string(./@type)", ctxt); if (type =3D=3D NULL) { @@ -1324,8 +1320,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, if (options =3D=3D NULL) return NULL; =20 - if (VIR_ALLOC(def) < 0) - return NULL; + def =3D g_new0(virStorageVolDef, 1); =20 def->target.type =3D VIR_STORAGE_TYPE_FILE; =20 @@ -1370,8 +1365,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, } } =20 - if (VIR_ALLOC(def->target.backingStore->perms) < 0) - return NULL; + def->target.backingStore->perms =3D g_new0(virStoragePerms, 1); if (virStorageDefParsePerms(ctxt, def->target.backingStore->perms, "./backingStore/permissions") < 0) return NULL; @@ -1417,8 +1411,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, } } =20 - if (VIR_ALLOC(def->target.perms) < 0) - return NULL; + def->target.perms =3D g_new0(virStoragePerms, 1); if (virStorageDefParsePerms(ctxt, def->target.perms, "./target/permissions") < 0) return NULL; --=20 2.26.2