From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BBCD7A046B for ; Thu, 27 Jun 2019 14:38:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6F7E21B950; Thu, 27 Jun 2019 14:38:20 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 737C41B197 for ; Thu, 27 Jun 2019 14:38:19 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2019 05:38:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,423,1557212400"; d="scan'208";a="313780444" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.3.102]) ([10.252.3.102]) by orsmga004.jf.intel.com with ESMTP; 27 Jun 2019 05:38:17 -0700 To: Bruce Richardson , dev@dpdk.org Cc: thomas@monjalon.net, jerinj@marvell.com References: <20190530212525.40370-1-bruce.richardson@intel.com> <20190627104055.8244-1-bruce.richardson@intel.com> <20190627104055.8244-8-bruce.richardson@intel.com> From: "Burakov, Anatoly" Message-ID: Date: Thu, 27 Jun 2019 13:38:16 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190627104055.8244-8-bruce.richardson@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 7/8] raw/ioat: add statistics functions 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" On 27-Jun-19 11:40 AM, Bruce Richardson wrote: > Add stats functions to track what is happening in the driver, and put > unit tests to check those. > > Signed-off-by: Bruce Richardson > --- > + /* allocate memory for xstats names and values */ > + nb_xstats = rte_rawdev_xstats_names_get(dev_id, NULL, 0); > + > + snames = malloc(sizeof(*snames) * nb_xstats); > + if (snames == NULL) { > + printf("Error allocating xstat names memory\n"); > + return -1; > + } > + rte_rawdev_xstats_names_get(dev_id, snames, nb_xstats); > + > + ids = malloc(sizeof(*ids) * nb_xstats); > + if (ids == NULL) { > + printf("Error allocating xstat ids memory\n"); > + return -1; Leaking snames here. > + } > + for (i = 0; i < nb_xstats; i++) > + ids[i] = i; > + > + stats = malloc(sizeof(*stats) * nb_xstats); > + if (stats == NULL) { > + printf("Error allocating xstat memory\n"); > + return -1; Leaking snames and ids here. Perhaps a goto and a ret value wouldn't hurt :) -- Thanks, Anatoly