From nobody Thu May 2 02:49:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597290630; cv=none; d=zohomail.com; s=zohoarc; b=hIbViwWXrm/vYb8DJMjPjyxlznchE6EJCdyvQiKECPZGkBS5wTmDgp43skgm3Hcwghf35aNicTJivQxVE/tHRpBpyZqxk+F0IS2ZbgIC5+nPpjEYARaRLp2hMfCjaXWckgeWiLUpWxfGoa0o3S6Z2Q4/t4VS6Hbgx8iohLqfDZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597290630; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=YmOmNylOJTdtkWGgUNz49pJfkvdDzxBL6KMta7AwBfc=; b=dus1w6bTRhNBbErsVmPhP3tQA/b0+2/eeGsjWDqc36Ue3g99FIUwgXA+fzz1bm8U1rmyMN5bx4wXBD07sopD7CJJsvKcAYjhpRiH+8zYlRCYLtlh8ZNgoqbiagdt8YwvSvHQzYKz6a+TY5ynaIv/DJs6LruOWoZv1DOab6uDBe0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1597290630683981.1992135823227; Wed, 12 Aug 2020 20:50:30 -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-233-bHP-Bnq_PAGFzDTLDJY48A-1; Wed, 12 Aug 2020 23:50:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8342A79EC1; Thu, 13 Aug 2020 03:50:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5145A5D733; Thu, 13 Aug 2020 03:50:19 +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 D78B4180B655; Thu, 13 Aug 2020 03:50:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07D3oA2W018763 for ; Wed, 12 Aug 2020 23:50:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id ECC2A110E992; Thu, 13 Aug 2020 03:50:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3D5B110E98B for ; Thu, 13 Aug 2020 03:50:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25F4B85A5B8 for ; Thu, 13 Aug 2020 03:50:07 +0000 (UTC) Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-Vt5GS1fnNjmc2FwbVhtQ5Q-1; Wed, 12 Aug 2020 23:50:04 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DEC178A45A4356C0A25C for ; Thu, 13 Aug 2020 11:49:59 +0800 (CST) Received: from huawei.com (10.175.101.6) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Thu, 13 Aug 2020 11:49:50 +0800 X-MC-Unique: bHP-Bnq_PAGFzDTLDJY48A-1 X-MC-Unique: Vt5GS1fnNjmc2FwbVhtQ5Q-1 From: Jin Yan To: Subject: [PATCH v2] virnetserver: fix some memory leaks in virNetTLSContextReloadForServer Date: Thu, 13 Aug 2020 11:37:56 +0800 Message-ID: <20200813033756.1411210-1-jinyan12@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] 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 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 07D3oA2W018763 X-loop: libvir-list@redhat.com Cc: fangying1@huawei.com, alex.chen@huawei.com, zhang.zhanghailiang@huawei.com, zhengchuan@huawei.com, yubihong@huawei.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.15 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 Content-Type: text/plain; charset="utf-8" These leaks were introduced in commit 15d280fa97b0, use g_autofree for all cert_path pointers. Signed-off-by: Jin Yan Reviewed-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza --- src/rpc/virnettlscontext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index 168f3010ae..37564db14e 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -921,10 +921,10 @@ int virNetTLSContextReloadForServer(virNetTLSContextP= tr ctxt, { gnutls_certificate_credentials_t x509credBak; int err; - char *cacert =3D NULL; - char *cacrl =3D NULL; - char *cert =3D NULL; - char *key =3D NULL; + g_autofree char *cacert =3D NULL; + g_autofree char *cacrl =3D NULL; + g_autofree char *cert =3D NULL; + g_autofree char *key =3D NULL; =20 x509credBak =3D ctxt->x509cred; ctxt->x509cred =3D NULL; --=20 2.23.0