From nobody Sat Feb 7 11:05:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1572789269; cv=none; d=zoho.com; s=zohoarc; b=R0c7lZYUtou70p89KIrde+xcWSokB61ZTxM2vDg2laAKH5pDNCgKh7XZf3krftwBgdoaNuX++E55gSkbb3oyNYNL80sWRHnGw33GXA3uD1yjnmeZ0ZBYOgjnlp2EN5B7PzrBrjgxG3K42M2eJJXg8aINAt6O7y+ayz7D99jJ3n0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572789269; h=Content-Type:Content-Transfer-Encoding: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=0dHd4yQ5O1GQh4drvooir8osk8OH1qlyMIs4z60fJxo=; b=IdEZg/AGfJGRU0Y4dQjZ1tZE+G0h6586+4ZkjCAnrDfuX0NNHkIQEMh3ruLV06LnsHT66cXxI0r9lFBj3vOL/+rHb7ewyCNFhRw6ts2K6KEPMwkapn40w5DkasI/YgTibXOPO9BfEwTm3zBVfaRqVgNFLHy2BI9JIZniqH5StzE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1572789269199646.358434157475; Sun, 3 Nov 2019 05:54:29 -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-428-EcvCJTSCM161hpsZ-Tbk6A-1; Sun, 03 Nov 2019 08:54:25 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 938D9180496F; Sun, 3 Nov 2019 13:54:20 +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 6D56D1001B34; Sun, 3 Nov 2019 13:54:20 +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 2C4BA4BB78; Sun, 3 Nov 2019 13:54:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA3DrjXi005794 for ; Sun, 3 Nov 2019 08:53:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 08F3F60874; Sun, 3 Nov 2019 13:53:45 +0000 (UTC) Received: from unknown04D3B0C4CC7D.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDE456085E for ; Sun, 3 Nov 2019 13:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572789268; 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=0dHd4yQ5O1GQh4drvooir8osk8OH1qlyMIs4z60fJxo=; b=c57AExGUKMtpFdXDZL4t96csWs76auFGcLqqImW9xYkcILQJIRohVExSfEsvOQlivIQ+3W QGCDGhtdpe8EIbgCJPlUrjCJT0hVJKgyZgpfxFHBxqeOYo0GgidBPcTgzstOE7Zbsjh8qI Nvg7QRAci6du5HuMg3Lj19weiKCDtaw= From: John Ferlan To: libvir-list@redhat.com Date: Sun, 3 Nov 2019 08:53:35 -0500 Message-Id: <20191103135340.3505-4-jferlan@redhat.com> In-Reply-To: <20191103135340.3505-1-jferlan@redhat.com> References: <20191103135340.3505-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/8] tests: Fix memory leak in mymain 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.84 on 10.5.11.22 X-MC-Unique: EcvCJTSCM161hpsZ-Tbk6A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit 944a35d7f0 added @fakerootdir; however, there are multiple paths out of mymain that didn't free the memory - so just use the g_autofree to resolve the potential leak. Found by Coverity Signed-off-by: John Ferlan --- tests/qemuhotplugtest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 4ff2b38c83..ebf4582ac1 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -595,7 +595,7 @@ mymain(void) int ret =3D 0; struct qemuHotplugTestData data =3D {0}; struct testQemuHotplugCpuParams cpudata; - char *fakerootdir; + g_autofree char *fakerootdir =3D NULL; =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 @@ -875,7 +875,6 @@ mymain(void) =20 if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); - VIR_FREE(fakerootdir); =20 qemuTestDriverFree(&driver); virObjectUnref(data.vm); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list