From nobody Mon Feb 9 06:26:19 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=1612359289; cv=none; d=zohomail.com; s=zohoarc; b=IQOL+/xdRDrf+z7lipUmuHq4qt54Mp2Gy0iSGeBRt2dGroIUbddjvdXKNXW2Fgm67oBEGFz9XAtKxfT1eU3lGP6UGCwaYVHYZQKjWGHJZgjSMs2sA5DPyaPbvYcq9Ciqu9GeDReZ7WQaM9OAj9yhdyLMKAbjmbpSK00vIPX6UaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612359289; 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=njKO7GAC77CfYm698/EEZWv+6hOqDNinnNcp1ukqwyw=; b=mSc033yKjbw0ddGaG+qls1DRt3M1bdbfEAPTSV6P1eqWFYtoHpZv72731KTnPsBx54yrLxnKZeRt5uBroDHs73q/8CZMY3kOzRPsOzKrh8spHRPQOqQd8aK/3Oi3H6dNR7hwtXizu5A8sl8p0O//N7awREWOAOH2NiKsyDJV/88= 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 1612359289229314.6023612383384; Wed, 3 Feb 2021 05:34:49 -0800 (PST) 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-374-bvZct4Q8MMOj1LL7P4KIeQ-1; Wed, 03 Feb 2021 08:34:46 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B5C6C107ACE8; Wed, 3 Feb 2021 13:34:40 +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 8E7995D9E3; Wed, 3 Feb 2021 13:34:40 +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 969B14EE76; Wed, 3 Feb 2021 13:34:36 +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 113DYXhf014042 for ; Wed, 3 Feb 2021 08:34:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1206F2CFCE; Wed, 3 Feb 2021 13:34:33 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D23E5C6B8 for ; Wed, 3 Feb 2021 13:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612359288; 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=njKO7GAC77CfYm698/EEZWv+6hOqDNinnNcp1ukqwyw=; b=QAuUSe9FLCglKI3jNp+Q+Ey2Iu+S5HjZYN3JTIxuNhxz3zW0Z+CfHEVaY91f9+cU2kyEgw 45r1BeMk8+/3ot54zIe6+PLd9QD5NBB1I5XEncPCtBlm9EWbb/cWhFtZ+aAOVEhwb8BzHk lUnmrzg7Dbu4k+QyLp5nfH6JOvfafsM= X-MC-Unique: bvZct4Q8MMOj1LL7P4KIeQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/6] virNWFilterVarCombIter: Allocate 'iter' member separately Date: Wed, 3 Feb 2021 14:34:21 +0100 Message-Id: <14b2747d77f15f5ae7e625882b514cdaebc9acfc.1612358891.git.pkrempa@redhat.com> 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.79 on 10.5.11.14 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Switch to the more common approach of having arrays allocated separately rather than trailing the struct. Signed-off-by: Peter Krempa --- src/conf/nwfilter_params.c | 6 ++++-- src/conf/nwfilter_params.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c index 18b64e373b..1be492759a 100644 --- a/src/conf/nwfilter_params.c +++ b/src/conf/nwfilter_params.c @@ -304,6 +304,8 @@ virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci) for (i =3D 0; i < ci->nIter; i++) g_free(ci->iter[i].varNames); + g_free(ci->iter); + g_free(ci); } @@ -465,8 +467,8 @@ virNWFilterVarCombIterCreate(GHashTable *hash, int iterIndex =3D -1; unsigned int nextIntIterId =3D VIR_NWFILTER_MAX_ITERID + 1; - if (VIR_ALLOC_VAR(res, virNWFilterVarCombIterEntry, 1 + nVarAccess) < = 0) - return NULL; + res =3D g_new0(virNWFilterVarCombIter, 1); + res->iter =3D g_new0(virNWFilterVarCombIterEntry, nVarAccess + 1); res->hashTable =3D hash; diff --git a/src/conf/nwfilter_params.h b/src/conf/nwfilter_params.h index 05a6a43399..59068b8ae9 100644 --- a/src/conf/nwfilter_params.h +++ b/src/conf/nwfilter_params.h @@ -137,7 +137,7 @@ typedef virNWFilterVarCombIter *virNWFilterVarCombIterP= tr; struct _virNWFilterVarCombIter { GHashTable *hashTable; size_t nIter; - virNWFilterVarCombIterEntry iter[0]; + virNWFilterVarCombIterEntryPtr iter; }; virNWFilterVarCombIterPtr virNWFilterVarCombIterCreate( GHashTable *hash, --=20 2.29.2