From nobody Sun Apr 12 15:42:02 2026 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1715761480; cv=none; d=zohomail.com; s=zohoarc; b=dv1rLOsUiF10u5bjb5M5RD5vrzZhHrtf2Jwx/+WHQmlN7e66o2vdcbDpj/iIA2j7+hBnZhgJF4gBUGa/6VtGbT5ALfiu2hyqCuZVVOTO8vvKaONKyMGgW+m8jNbgEM65fsstlXKDnDpcyPNPynyYztvCS67F7b6uiNh1lIXyaP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715761480; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=B+90PjytwkJfci+5QuyMikal/rNxhN7qftwCvOKo+h8=; b=dmi0mdWL01ts3GSooAuf/q14KjmnVcBfB+dBIG/zQ1dE1SzuvW98grIVgpwL+mEBK+22b7Fpk90a1eduR+4wxsmeYxLNPNeGgFTCY27RwyuUTpBnEtgIQENIBNdV2GOJrRn6UpLANTfoDzYy78NzJGd9JklypJZigDz3mfyeGcA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17157614801611001.5245891005502; Wed, 15 May 2024 01:24:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79vW-00025N-Du; Wed, 15 May 2024 04:23:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79vT-00024u-Ll for qemu-devel@nongnu.org; Wed, 15 May 2024 04:23:51 -0400 Received: from mgamail.intel.com ([198.175.65.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s79vQ-00074Z-4f for qemu-devel@nongnu.org; Wed, 15 May 2024 04:23:49 -0400 Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2024 01:23:47 -0700 Received: from unknown (HELO SPR-S2600BT.bj.intel.com) ([10.240.192.124]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2024 01:23:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715761428; x=1747297428; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VlvBMGhf60hfdjyVlOQFajbnzmL35wKO33aDoRdZ4yQ=; b=AU5JDGtA4moi1IghHFU1bJTH4AONY9nWikOaGsH/W9noqmxARxaHt/XX LnSveXEQXQQMyVxSgxWh+jbUHvTPXMlXojhp4zbJ9UQTPS2sjffJUsKsa 9AntcyBAF0PfE79jBbi7p+d207m5InHQCKKEF2WRDR0SjEKn9vJ3ohmO+ XkyxbBw9IStYlqAMEBzlo/fOlT6k+xnxWfNt0AdpYA1jLv45F4WJhDjpF PSQApNdALZHJMUAZxSCuhwephWsKiopqqdZpOjfYnqOaUOYsjn0phrc7r nqE+omGuQ0gxlC5IJ+0WvPIh7JgVy8BNx3NlE/1mwSolED1FI+tsObrtA w==; X-CSE-ConnectionGUID: sO9k9fcsRDyhPyJostEiIQ== X-CSE-MsgGUID: 5C3PlVMFTdqhARORZH0nwA== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="11961521" X-IronPort-AV: E=Sophos;i="6.08,161,1712646000"; d="scan'208";a="11961521" X-CSE-ConnectionGUID: TpSNSSeIRa6LIfIzU+juxQ== X-CSE-MsgGUID: /au0eGn0Qs28TDlnELG2DQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,161,1712646000"; d="scan'208";a="31396255" From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, clg@redhat.com, eric.auger@redhat.com, chao.p.peng@intel.com, Zhenzhong Duan Subject: [PATCH 03/16] vfio/helpers: Use g_autofree in hw/vfio/helpers.c Date: Wed, 15 May 2024 16:20:28 +0800 Message-Id: <20240515082041.556571-4-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515082041.556571-1-zhenzhong.duan@intel.com> References: <20240515082041.556571-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.18; envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.974, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1715761481180100003 Content-Type: text/plain; charset="utf-8" Changed functions include vfio_set_irq_signaling() and vfio_region_setup(). Signed-off-by: Zhenzhong Duan --- hw/vfio/helpers.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c index 47b4096c05..0bb7b40a6a 100644 --- a/hw/vfio/helpers.c +++ b/hw/vfio/helpers.c @@ -111,7 +111,7 @@ int vfio_set_irq_signaling(VFIODevice *vbasedev, int in= dex, int subindex, int action, int fd, Error **errp) { ERRP_GUARD(); - struct vfio_irq_set *irq_set; + g_autofree struct vfio_irq_set *irq_set =3D NULL; int argsz, ret =3D 0; const char *name; int32_t *pfd; @@ -130,7 +130,6 @@ int vfio_set_irq_signaling(VFIODevice *vbasedev, int in= dex, int subindex, if (ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set)) { ret =3D -errno; } - g_free(irq_set); =20 if (!ret) { return 0; @@ -348,7 +347,7 @@ static int vfio_setup_region_sparse_mmaps(VFIORegion *r= egion, int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *regio= n, int index, const char *name) { - struct vfio_region_info *info; + g_autofree struct vfio_region_info *info =3D NULL; int ret; =20 ret =3D vfio_get_region_info(vbasedev, index, &info); @@ -381,8 +380,6 @@ int vfio_region_setup(Object *obj, VFIODevice *vbasedev= , VFIORegion *region, } } =20 - g_free(info); - trace_vfio_region_setup(vbasedev->name, index, name, region->flags, region->fd_offset, region->size= ); return 0; --=20 2.34.1