From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id B87B0326C for ; Tue, 4 Apr 2017 11:41:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491298919; x=1522834919; h=from:to:cc:subject:date:message-id; bh=bo+Gt+mN2fptKPeau2ZR3q9j6dkH07YEVyNlVhQWSIg=; b=Yf9dZUDb14d3z1R7tgW7LDePp6JViUPc0y7Jj3F4qhLbntPhQjm7V3xL nrIZOJEjNcC7sUx6yClUaIsugOLU4Q==; Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2017 02:41:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,274,1486454400"; d="scan'208";a="84418153" Received: from silpixa00397515.ir.intel.com (HELO silpixa00397515.ger.corp.intel.com) ([10.237.223.14]) by fmsmga006.fm.intel.com with ESMTP; 04 Apr 2017 02:41:57 -0700 From: David Hunt To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.hunt@intel.com Date: Tue, 4 Apr 2017 03:42:41 +0100 Message-Id: <1491273761-112722-1-git-send-email-david.hunt@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v1] lib: fix coverity issues in distributor allocation 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: , X-List-Received-Date: Tue, 04 Apr 2017 09:42:00 -0000 Coverity issue 143258: not freeing distributor instance Coverity issue 143254: not checking return code from malloc Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Signed-off-by: David Hunt --- lib/librte_distributor/rte_distributor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 06df13d..4725904 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -621,9 +621,14 @@ rte_distributor_create_v1705(const char *name, if (alg_type == RTE_DIST_ALG_SINGLE) { d = malloc(sizeof(struct rte_distributor)); + if (d == NULL) { + rte_errno = ENOMEM; + return NULL; + } d->d_v20 = rte_distributor_create_v20(name, socket_id, num_workers); if (d->d_v20 == NULL) { + free(d); /* rte_errno will have been set */ return NULL; } -- 2.7.4