From nobody Tue May 7 07:05:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488563605426151.43569619597747; Fri, 3 Mar 2017 09:53:25 -0800 (PST) Received: from localhost ([::1]:59446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjrON-0007MG-L4 for importer@patchew.org; Fri, 03 Mar 2017 12:53:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjrNq-0007Ly-Eq for qemu-devel@nongnu.org; Fri, 03 Mar 2017 12:52:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjrNn-0007Dk-Bf for qemu-devel@nongnu.org; Fri, 03 Mar 2017 12:52:50 -0500 Received: from 2.mo173.mail-out.ovh.net ([178.33.251.49]:36287) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cjrNn-0007D5-5i for qemu-devel@nongnu.org; Fri, 03 Mar 2017 12:52:47 -0500 Received: from player726.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 0E48D2941D for ; Fri, 3 Mar 2017 18:52:45 +0100 (CET) Received: from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139]) (Authenticated sender: groug@kaod.org) by player726.ha.ovh.net (Postfix) with ESMTPA id 9A9342A0083; Fri, 3 Mar 2017 18:52:42 +0100 (CET) From: Greg Kurz To: qemu-devel@nongnu.org Date: Fri, 03 Mar 2017 18:52:42 +0100 Message-ID: <148856356236.7604.4296371092878661257.stgit@bahia.lan> User-Agent: StGit/0.17.1-20-gc0b1b-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 12496363066201577865 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelhedrfeeggddutdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.251.49 Subject: [Qemu-devel] [PATCH] 9pfs: fix fd leak in local_opendir() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Coverity issue CID1371731 Signed-off-by: Greg Kurz Reviewed-by: Daniel P. Berrange Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/9pfs/9p-local.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index e31309a29c58..fe930300445a 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -435,6 +435,7 @@ static int local_opendir(FsContext *ctx, =20 stream =3D fdopendir(dirfd); if (!stream) { + close(dirfd); return -1; } fs->dir.stream =3D stream;