From nobody Tue Feb 10 12:39:48 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=fail(p=quarantine dis=quarantine) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1672922005; cv=none; d=zohomail.com; s=zohoarc; b=jAZIAVbDNc+IFMXLEWAMfFMm1ZbpbUgDIpUKPKwPEqgjHyMu9TZRhHieZUejgE71q/c8SxmlLUL9UeE91e5rIbHM+HQRolJBT0jQh9Yc86oDNIRCy51DSQH+JGcZWCHLxLaqDQTPPxRhkOWDl2MpbHS/hvSDyLSLiAac6dwqo7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672922005; h=Content-Type:Content-Transfer-Encoding:Cc: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=UdZMB56Uj6xMDus53ElWOrRY1YmnveGqjkaiLldVokg=; b=Sp5eMKs++0Resj8le0nyJTgffCdNKrdSKtypkmTlM5iw7bT8xclkHaSZw+5wZfiJKqLPvLY9uiExMpSTNB3tCYlJdW9XP3x1tZ9An5magQO/jZNIDKmgTQlwGtalPUMeA/yecKCAmw1YI47alFiKB8mZPGQz1bgLTqJ9FTU3M7A= 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=fail header.from= (p=quarantine dis=quarantine) 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 1672922005898456.64534799635715; Thu, 5 Jan 2023 04:33:25 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-78-j1c5LPpnMTuzGTCK2Lo5qg-1; Thu, 05 Jan 2023 07:33:20 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35ABF29DD996; Thu, 5 Jan 2023 12:33:16 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 226501121315; Thu, 5 Jan 2023 12:33:16 +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 110651946589; Thu, 5 Jan 2023 12:33:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1ADF41946589 for ; Thu, 5 Jan 2023 12:33:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0EA24492B0B; Thu, 5 Jan 2023 12:33:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06BF8492B08 for ; Thu, 5 Jan 2023 12:33:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 D4E7138123B6 for ; Thu, 5 Jan 2023 12:33:12 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-571-JgU_OR-4N1WXceytgHi6lg-1; Thu, 05 Jan 2023 07:33:10 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nnm3G3YMWzqTwn for ; Thu, 5 Jan 2023 20:28:26 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 20:33:06 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672922004; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=UdZMB56Uj6xMDus53ElWOrRY1YmnveGqjkaiLldVokg=; b=L84gtZnOMlGrF9N9wbenhZrK8rH0ETf+Zm8P2l1josszes7TodL4BHrrokhxVypiXYlS2j OIhSZ2tSwoSWxmRphewBt0uwm0Z6ZQaexLVOb+kxsutHwGglPZ84ZKVdMLrmUr28o7oHFC 0w5a3/yZWDJBrA1c9nwH+R2XY0Zc77k= X-MC-Unique: j1c5LPpnMTuzGTCK2Lo5qg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: JgU_OR-4N1WXceytgHi6lg-1 From: Jiang Jiacheng To: Subject: [PATCH 5/9] rpc: use g_autofree and remove unnecessary label Date: Thu, 5 Jan 2023 20:26:51 +0800 Message-ID: <20230105122655.3413625-6-jiangjiacheng@huawei.com> In-Reply-To: <20230105122655.3413625-1-jiangjiacheng@huawei.com> References: <20230105122655.3413625-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: , Cc: yubihong@huawei.com, zhengchuan@huawei.com, linyilu@huawei.com, jiangjiacheng@huawei.com, xiexiangyou@huawei.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1672922006387100008 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiang Jiacheng --- src/rpc/virnetclientprogram.c | 6 ++---- src/rpc/virnettlscontext.c | 16 +++++----------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c index 5da118bfd3..b93c495347 100644 --- a/src/rpc/virnetclientprogram.c +++ b/src/rpc/virnetclientprogram.c @@ -208,7 +208,7 @@ int virNetClientProgramDispatch(virNetClientProgram *pr= og, virNetMessage *msg) { virNetClientProgramEvent *event; - char *evdata; + g_autofree char *evdata =3D NULL; =20 VIR_DEBUG("prog=3D%d ver=3D%d type=3D%d status=3D%d serial=3D%d proc= =3D%d", msg->header.prog, msg->header.vers, msg->header.type, @@ -250,14 +250,12 @@ int virNetClientProgramDispatch(virNetClientProgram *= prog, evdata =3D g_new0(char, event->msg_len); =20 if (virNetMessageDecodePayload(msg, event->msg_filter, evdata) < 0) - goto cleanup; + return 0; =20 event->func(prog, client, evdata, prog->eventOpaque); =20 xdr_free(event->msg_filter, evdata); =20 - cleanup: - VIR_FREE(evdata); return 0; } =20 diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index acfc4f9323..cfd26f0701 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -474,7 +474,7 @@ static gnutls_x509_crt_t virNetTLSContextLoadCertFromFi= le(const char *certFile, { gnutls_datum_t data; gnutls_x509_crt_t cert =3D NULL; - char *buf =3D NULL; + g_autofree char *buf =3D NULL; int ret =3D -1; =20 VIR_DEBUG("isServer %d certFile %s", @@ -506,7 +506,6 @@ static gnutls_x509_crt_t virNetTLSContextLoadCertFromFi= le(const char *certFile, if (ret !=3D 0) { g_clear_pointer(&cert, gnutls_x509_crt_deinit); } - VIR_FREE(buf); return cert; } =20 @@ -517,14 +516,13 @@ static int virNetTLSContextLoadCACertListFromFile(con= st char *certFile, size_t *ncerts) { gnutls_datum_t data; - char *buf =3D NULL; - int ret =3D -1; + g_autofree char *buf =3D NULL; =20 *ncerts =3D 0; VIR_DEBUG("certFile %s", certFile); =20 if (virFileReadAll(certFile, (1<<16), &buf) < 0) - goto cleanup; + return -1; =20 data.data =3D (unsigned char *)buf; data.size =3D strlen(buf); @@ -533,15 +531,11 @@ static int virNetTLSContextLoadCACertListFromFile(con= st char *certFile, virReportError(VIR_ERR_SYSTEM_ERROR, _("Unable to import CA certificate list %s"), certFile); - goto cleanup; + return -1; } *ncerts =3D certMax; =20 - ret =3D 0; - - cleanup: - VIR_FREE(buf); - return ret; + return 0; } =20 =20 --=20 2.33.0