From nobody Sun Feb 8 10:49:03 2026 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582526817; cv=none; d=zohomail.com; s=zohoarc; b=WFo9TuXq00AutsLAfKBnZBjZnzvrUR6zwNbr4GyQWX574BWVzkSBxp7zvsVt/0cTNZSaWFRrvIHt7XgkJ9PY6W6Way2g23QhlsweSO3Qn697LhzSV7wyWP0O3lCw6URvh3vFoH21zH+CEOkIK1Bog/qI//H8Gr0eo3mqRrYU2sk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582526817; 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=CAvfZ0Yr86NpFcHvXsRBi0mDOcNHYbYQeQGnNMy4zrU=; b=Js+QAro+hR5n9KChD41g0k+yfL9r53z81Ol17P4TY6w4Xx0wDei4Sj8LIuvpDB4WFOQ8ZqHBjp80ks75I8ecZUEEw1uy9fVzvuz7BYO/8DJHcdrGXcNjY7nCWLpY0h9H8vZ2656Hbfi3IyjTp/MSavuunMamF5ZfCZ2hVGnYetg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= 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 1582526817245122.83843319551727; Sun, 23 Feb 2020 22:46:57 -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-245-ZxJ2wOonOqmoEPULM2hdUg-1; Mon, 24 Feb 2020 01:46:53 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 279CF13E2; Mon, 24 Feb 2020 06:46:47 +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 CA87F8AC41; Mon, 24 Feb 2020 06:46:46 +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 53E2F18089CD; Mon, 24 Feb 2020 06:46:41 +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 01O6kcIT025535 for ; Mon, 24 Feb 2020 01:46:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 418B010E60DF; Mon, 24 Feb 2020 06:46:38 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BE7C10E60DD for ; Mon, 24 Feb 2020 06:46:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 50BB6185A78F for ; Mon, 24 Feb 2020 06:46:36 +0000 (UTC) Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-183-fhPDSytQOpu5MjO4z25xig-1; Mon, 24 Feb 2020 01:46:34 -0500 Received: by mail-yb1-f178.google.com with SMTP id f130so4179124ybc.7 for ; Sun, 23 Feb 2020 22:46:33 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id j184sm4821447ywa.39.2020.02.23.22.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2020 22:46:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582526816; 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=CAvfZ0Yr86NpFcHvXsRBi0mDOcNHYbYQeQGnNMy4zrU=; b=VS4oYNj6UuCEyGVhUhgiTdtSXtDpmSOP7/xBPAisAdo622vnHgy5UYbV/6bvtvEJO+K9L/ cpiZIWs41RunUJfneUzv9P9Fp7FDDmvpQO5lxZsHvI9TAaFylP/12alenEHKZ/tLi74PtA DkrIlOJKz0rE0gFWE6DRlsLD7mdWdE0= X-MC-Unique: ZxJ2wOonOqmoEPULM2hdUg-1 X-MC-Unique: fhPDSytQOpu5MjO4z25xig-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s4ok1dRUqzdWMRIhpNRYjA/BlsAEK4JrNzgG+JqPlOs=; b=DVgnTPTqcnWyqMaQAyG7yxivvZIQp5hh3K5hZA5/z1AjGh9Lt9Gt+8SP0nQGJ997TQ oqlBLpMOHvMWW4nvkWxOaNd2qsG2bFARL+4ZX+hoghtgoD8OG4QpIErR4x8Jol036FhU bXbgo/tNwCe07X+OuiLbKyb7cuAb1d3hS12C2MWYVOqe+61hgAFlYIC0yPXziKw4htG7 bfXijrJS60Gux8NThz4jjKAI5KMQt8tVdjxdMI0HyGJ+v7ZBW2kaKIVuyWWA1UdM66mY gnGuCW2CBT1nj608507TQTWHTfnOHk+MVvSIay19OLswjxD/Yrdq1AKJ0VjxkuC2BAIE bMzg== X-Gm-Message-State: APjAAAUJxF+Da6ERt4KAB5sydg89ZXrsPgjJvT5v7l3nNLdPdO+gXQ4U 0S0zntXvXP0mr7G28cX91qdkT9vm7nVDiHWZrm3YZ/onmIsBbNTmjERfpbw587EdhhYY6BZCPtv aw2ZQCZl5UcTa9NIczyzgay9LpLPBJ7gxE56JJT66RFwSKKkWRfF4lPkQn3mrR6ylFXw= X-Google-Smtp-Source: APXvYqy2lzKMR1MRHaPeQ4BnrzqKTvJIDNVNCoWWFOndnMXxZHykX4SoVfXXUDRtp22jXQggqmTwFw== X-Received: by 2002:a25:4156:: with SMTP id o83mr42428958yba.344.1582526793194; Sun, 23 Feb 2020 22:46:33 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH v1 02/12] conf: fix use after free Date: Mon, 24 Feb 2020 01:46:14 -0500 Message-Id: <20200224064624.66649-3-ryan@iXsystems.com> In-Reply-To: <20200224064624.66649-1-ryan@iXsystems.com> References: <20200224064624.66649-1-ryan@iXsystems.com> MIME-Version: 1.0 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 01O6kcIT025535 X-loop: libvir-list@redhat.com Cc: Ryan Moeller 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller Reviewed-by: Daniel P. Berrang=C3=A9 --- src/conf/virnetworkobj.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 299cdba52d..b2affaacd3 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -1886,7 +1886,7 @@ virNetworkObjLoadAllPorts(virNetworkObjPtr net, } =20 while ((rc =3D virDirRead(dh, &de, dir)) > 0) { - char *file =3D NULL; + g_autofree char *file =3D NULL; =20 if (!virStringStripSuffix(de->d_name, ".xml")) continue; @@ -1894,9 +1894,6 @@ virNetworkObjLoadAllPorts(virNetworkObjPtr net, file =3D g_strdup_printf("%s/%s.xml", dir, de->d_name); =20 portdef =3D virNetworkPortDefParseFile(file); - VIR_FREE(file); - file =3D NULL; - if (!portdef) { VIR_WARN("Cannot parse port %s", file); continue; --=20 2.24.1