From nobody Sun Feb 8 17:41:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1697443767; cv=none; d=zohomail.com; s=zohoarc; b=AOMNCVGUykkcuBezIBU4J4HHvcy4wsAOLor8dRoJl5/c71sv/LQNVo7GPMbUOc/y5FEeED9rRIzeThfPTFTERt4XN8T32+fwStlu0dn2O0YtNre2b55UEYAW5wBq0/ipRKExNaTlC57BbmhYTEXaCGKdyVQDQ2b6N/lCBEJKycA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697443767; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=th2jsGuUOmeUzodeAUNBX1ndRmnGLxf5RzDeutYa56E=; b=ZvIoJkxbr/ZUU1HXEJau+HTjdKyM28cQLrv6RPyvpp0HmkRjV+f4AJF2InC35Hn5uauRBfHTzYkoVj2wdrjp20IRCtikdbX/o7eXa6281rOZOxIg4UqwpIx4QRW0nlw8yX9fDrxWbSbJw+v5kZ8yaCrKl6UUwT+gjp19WqidBDc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1697443767604451.86654688013357; Mon, 16 Oct 2023 01:09:27 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-48-6l2LwTE-MTqyfmTnO14ovg-1; Mon, 16 Oct 2023 04:08:00 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EAAEE1029F48; Mon, 16 Oct 2023 08:07:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1A0825CE; Mon, 16 Oct 2023 08:07:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 40BAE19466F5; Mon, 16 Oct 2023 08:07:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3C4531946587 for ; Mon, 16 Oct 2023 08:07:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0F1C540C6CA3; Mon, 16 Oct 2023 08:07:55 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9B2C40C6F79 for ; Mon, 16 Oct 2023 08:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697443766; 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=th2jsGuUOmeUzodeAUNBX1ndRmnGLxf5RzDeutYa56E=; b=FGXjSbPtVRiN2ayG7M0UOryBqFWAvMCvgMMivekGqZNfhf3OgJOOu/+ctaVbd6lafWVw1z cMP4jOYFPTtAGw6aLn5ydjtocO8HjblJf96vGHLigSoJw0Tf6GSVqal5kR1plgJ6fmkgox +tESXm0Rc/7qAqR0pPyKQ9mPgnOd4SQ= X-MC-Unique: 6l2LwTE-MTqyfmTnO14ovg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] virSecretLoadAllConfigs: Use g_autofree for @path Date: Mon, 16 Oct 2023 10:07:50 +0200 Message-ID: <4d50b37e60f33ff74b75eaba018bd722bc7117ab.1697443656.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1697443769400100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When loading virSecret configs, the @path variable holds path to individual config files. In each iteration it is freed explicitly using VIR_FREE(). Switch it to g_autofree and remove those explicit calls. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/conf/virsecretobj.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index e0393e6cec..2585b2c972 100644 --- a/src/conf/virsecretobj.c +++ b/src/conf/virsecretobj.c @@ -902,7 +902,7 @@ virSecretLoadAllConfigs(virSecretObjList *secrets, /* Ignore errors reported by readdir or other calls within the * loop (if any). It's better to keep the secrets we managed to find.= */ while (virDirRead(dir, &de, NULL) > 0) { - char *path; + g_autofree char *path =3D NULL; virSecretObj *obj; =20 if (!virStringHasSuffix(de->d_name, ".xml")) @@ -914,11 +914,9 @@ virSecretLoadAllConfigs(virSecretObjList *secrets, if (!(obj =3D virSecretLoad(secrets, de->d_name, path, configDir))= ) { VIR_ERROR(_("Error reading secret: %1$s"), virGetLastErrorMessage()); - VIR_FREE(path); continue; } =20 - VIR_FREE(path); virSecretObjEndAPI(&obj); } =20 --=20 2.41.0