From patchwork Thu Apr 19 11:04:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Laatz X-Patchwork-Id: 38520 X-Patchwork-Delegate: cristian.dumitrescu@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2B7D17CC3; Thu, 19 Apr 2018 13:04:23 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id D6F587CC3 for ; Thu, 19 Apr 2018 13:04:21 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2018 04:04:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,468,1517904000"; d="scan'208";a="49129883" Received: from silpixa00397517.ir.intel.com (HELO silpixa00397517.ger.corp.intel.com) ([10.237.222.54]) by orsmga001.jf.intel.com with ESMTP; 19 Apr 2018 04:04:19 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, Kevin Laatz , jasvinder.singh@intel.com Date: Thu, 19 Apr 2018 12:04:18 +0100 Message-Id: <20180419110418.8099-1-kevin.laatz@intel.com> X-Mailer: git-send-email 2.9.5 Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: fix resource leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Closing the fd_server file descriptor on error to fix the resource leak. Coverity issue: 272587 Fixes: 4bbf8e30aa5e ("examples/ip_pipeline: add CLI interface") Cc: jasvinder.singh@intel.com Signed-off-by: Kevin Laatz Reviewed-by: Jasvinder Singh --- examples/ip_pipeline/conn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/ip_pipeline/conn.c b/examples/ip_pipeline/conn.c index 9338942..6b08e9e 100644 --- a/examples/ip_pipeline/conn.c +++ b/examples/ip_pipeline/conn.c @@ -96,12 +96,14 @@ conn_init(struct conn_params *p) sizeof(server_address)); if (status == -1) { conn_free(conn); + close(fd_server); return NULL; } status = listen(fd_server, 16); if (status == -1) { conn_free(conn); + close(fd_server); return NULL; } @@ -109,6 +111,7 @@ conn_init(struct conn_params *p) fd_client_group = epoll_create(1); if (fd_client_group == -1) { conn_free(conn); + close(fd_server); return NULL; }