From nobody Mon Feb 9 00:54:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1565189188; cv=none; d=zoho.com; s=zohoarc; b=ZvGS60bCDs2DvvYu7OG0peYxhnNGVkglHr6ufExFddvWLHSPTCFcPzfbkXpDdNYzoZiR78/2dpA8X20C1HcAk7CjctKigiG1YJ+6X19pQD8r0GDVKIJ7JKqjkoe656eihwRJUhL+pulI6B2JpcARiowhUpxjwFEqcb+bbeOXDjk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565189188; 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:ARC-Authentication-Results; bh=ssgl0AlqqQ3EL8Djb8gOaSv3FdpckNW1mPtGFZCyLKA=; b=C6c4zuV4S6fkGZe35p1vclM2dMAzNs9mTyMb7jYuCAeZIlRneZK08dBz2yGiFrLAydzGPGc5AUHzbUK5mb+hHkv8QhafNZa+QYqq23W1jp0I5dVahMceQ4FzPaMLS9LHcbeWtfdEug1zvtzbz373h1iVeXnKyU8AAeHdHjWhWI4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565189188836171.85535791697703; Wed, 7 Aug 2019 07:46:28 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A8CB13001A65; Wed, 7 Aug 2019 14:46:27 +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 7FE291001284; Wed, 7 Aug 2019 14:46:27 +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 3D0BA180B536; Wed, 7 Aug 2019 14:46:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x77EjjMY030538 for ; Wed, 7 Aug 2019 10:45:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id E251E80364; Wed, 7 Aug 2019 14:45:45 +0000 (UTC) Received: from unknown04D3B0C4CC7D.redhat.com (ovpn-116-53.phx2.redhat.com [10.3.116.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 479D61E1 for ; Wed, 7 Aug 2019 14:45:45 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 7 Aug 2019 10:45:42 -0400 Message-Id: <20190807144542.10639-3-jferlan@redhat.com> In-Reply-To: <20190807144542.10639-1-jferlan@redhat.com> References: <20190807144542.10639-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 07 Aug 2019 14:46:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit d2899a648 added a new exit path, but didn't free @fakerootdir. Let's just use VIR_AUTOFREE instead to make life easier. Found by Coverity Signed-off-by: John Ferlan --- tests/virhostdevtest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 7d15a87797..20984f3442 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -556,7 +556,7 @@ static int mymain(void) { int ret =3D 0; - char *fakerootdir; + VIR_AUTOFREE(char *) fakerootdir =3D NULL; =20 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { fprintf(stderr, "Out of memory\n"); @@ -594,8 +594,6 @@ mymain(void) if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); =20 - VIR_FREE(fakerootdir); - return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list