From nobody Mon Feb 9 01:21:09 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; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608098519; cv=none; d=zohomail.com; s=zohoarc; b=T+BVM7122fSDXVB9239zY8P8/suV2HVWVAeFGjdMsjO8q/enfXs8vHVQJg1T8YatdyWUXaWkH7zEM9lyU+l0dyLR3LRHheSpX1hkeAdU/UiMRKK5MTJhywenPetQVhCzK40UMfOz3mg5NZh+BTcy4LJ4X2n9NzyR4MHR6yRwVa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608098519; 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=wNJYqhNwVaYLSNWbYLDIItNyOURu5w5Vgw7lIVBTMp8=; b=kEAaXPXxx/Ga80ZNIiu+WzK9qHo+ogR+ON9Pq4jAIDMZCGWpnylNMlIhJzR4RYKJetxheJ0HqVk4Riz67dAqCF8mKft7wxr3Edxu8q8HO7jIqlJr8B2S9zCG1bo4sDPnfVj/qSWV9So0VknivEux/dx/w9VEAoXcNkvvjam8fj8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com 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 1608098519085639.7231594632807; Tue, 15 Dec 2020 22:01:59 -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-66-ZTxUFeFHP_upb84bm4OJzw-1; Wed, 16 Dec 2020 01:01:54 -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 860AD8015DB; Wed, 16 Dec 2020 06:01:49 +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 983F35D9F1; Wed, 16 Dec 2020 06:01:48 +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 2C2F44BB40; Wed, 16 Dec 2020 06:01:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BG61fcR018863 for ; Wed, 16 Dec 2020 01:01:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 08D972026D5D; Wed, 16 Dec 2020 06:01:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 034582026D48 for ; Wed, 16 Dec 2020 06:01:40 +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 532F2101A53F for ; Wed, 16 Dec 2020 06:01:40 +0000 (UTC) Received: from m97136.mail.qiye.163.com (m97136.mail.qiye.163.com [220.181.97.136]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-8KJhXnorMWKfcWM1VS0yKQ-1; Wed, 16 Dec 2020 01:01:33 -0500 Received: from localhost.localdomain (unknown [113.128.197.238]) by smtp2 (Coremail) with SMTP id iOCowACXdvCzotlfMxHeCg--.15612S5; Wed, 16 Dec 2020 14:01:28 +0800 (CST) X-MC-Unique: ZTxUFeFHP_upb84bm4OJzw-1 X-MC-Unique: 8KJhXnorMWKfcWM1VS0yKQ-1 From: Shi Lei To: libvir-list@redhat.com Subject: [PATCHv3 3/3] lxc: fix a memory leak Date: Wed, 16 Dec 2020 14:01:06 +0800 Message-Id: <20201216060106.44120-4-shi_lei@massclouds.com> In-Reply-To: <20201216060106.44120-1-shi_lei@massclouds.com> References: <20201216060106.44120-1-shi_lei@massclouds.com> MIME-Version: 1.0 X-CM-TRANSID: iOCowACXdvCzotlfMxHeCg--.15612S5 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfUpEfODUUUU X-Originating-IP: [113.128.197.238] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbiAwz8T1ilmJnQJQAAs1 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.4 X-loop: libvir-list@redhat.com Cc: Shi Lei , laine@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 Content-Type: text/plain; charset="utf-8" In virLXCProcessSetupInterfaceTap, containerVeth needs to be freed on failure. Signed-off-by: Shi Lei --- src/lxc/lxc_process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 85d0287a..0f7c9295 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -303,7 +303,7 @@ virLXCProcessSetupInterfaceTap(virDomainDefPtr vm, const char *brname) { char *parentVeth; - char *containerVeth =3D NULL; + g_autofree char *containerVeth =3D NULL; const virNetDevVPortProfile *vport =3D virDomainNetGetActualVirtPortPr= ofile(net); =20 VIR_DEBUG("calling vethCreate()"); @@ -357,7 +357,7 @@ virLXCProcessSetupInterfaceTap(virDomainDefPtr vm, virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) <= 0) return NULL; =20 - return containerVeth; + return g_steal_pointer(&containerVeth); } =20 =20 --=20 2.25.1