From patchwork Mon Aug 27 06:42:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10576409 X-Patchwork-Delegate: hal@mellanox.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 294DD15A7 for ; Mon, 27 Aug 2018 06:43:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CD322943F for ; Mon, 27 Aug 2018 06:43:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 116842971F; Mon, 27 Aug 2018 06:43:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 548402971E for ; Mon, 27 Aug 2018 06:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727072AbeH0K2O (ORCPT ); Mon, 27 Aug 2018 06:28:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45458 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726874AbeH0K2O (ORCPT ); Mon, 27 Aug 2018 06:28:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 715A24023461; Mon, 27 Aug 2018 06:42:56 +0000 (UTC) Received: from lhg.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2F972166B41; Mon, 27 Aug 2018 06:42:54 +0000 (UTC) From: Honggang LI To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH 2/5] Close fd before return to avoid resource leak Date: Mon, 27 Aug 2018 14:42:30 +0800 Message-Id: <20180827064233.3218-2-honli@redhat.com> In-Reply-To: <20180827064233.3218-1-honli@redhat.com> References: <20180827064233.3218-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 27 Aug 2018 06:42:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 27 Aug 2018 06:42:56 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'honli@redhat.com' RCPT:'' Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Honggang Li Issue was found by Coverity. Signed-off-by: Honggang Li --- opensm/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opensm/main.c b/opensm/main.c index ba20d985..2d23fe2b 100644 --- a/opensm/main.c +++ b/opensm/main.c @@ -565,6 +565,8 @@ static int daemonize(osm_opensm_t * osm) dup2(fd, 1); dup2(fd, 2); + close(fd); + return 0; }