From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 01341A0547; Mon, 24 May 2021 10:58:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3D484110A; Mon, 24 May 2021 10:58:53 +0200 (CEST) Received: from proxy.6wind.com (host.78.145.23.62.rev.coltfrance.com [62.23.145.78]) by mails.dpdk.org (Postfix) with ESMTP id E02274003E; Mon, 24 May 2021 10:58:52 +0200 (CEST) Received: from localhost (unknown [10.16.0.39]) by proxy.6wind.com (Postfix) with ESMTP id CA0969B479E; Mon, 24 May 2021 10:58:52 +0200 (CEST) From: Thierry Herbelot To: dev@dpdk.org Cc: Thierry Herbelot , Thomas Monjalon , stable@dpdk.org, Jerin Jacob , Kiran Kumar K Date: Mon, 24 May 2021 10:58:50 +0200 Message-Id: <20210524085850.16095-1-thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] graph_stats: do not use a possibly NULL Pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Use stats only after it was checked not to be NULL. Fixes: af1ae8b6a32c9 ("graph: implement stats") Cc: stable@dpdk.org Cc: Jerin Jacob Cc: Kiran Kumar K Signed-off-by: Thierry Herbelot --- lib/graph/graph_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c index 125e08d73290..a52994f0f61e 100644 --- a/lib/graph/graph_stats.c +++ b/lib/graph/graph_stats.c @@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster, cluster_node_size = RTE_ALIGN(cluster_node_size, RTE_CACHE_LINE_SIZE); stats = realloc(NULL, sz); - memset(stats, 0, sz); if (stats) { + memset(stats, 0, sz); stats->fn = fn; stats->cluster_node_size = cluster_node_size; stats->max_nodes = 0; -- 2.29.2