From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 5E441201; Tue, 24 Jan 2017 21:27:05 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id d140so37498131wmd.2; Tue, 24 Jan 2017 12:27:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Avl67Z0cyTYI8btTR81/Gr3wIhc7BtMos9AaUEaVDcI=; b=MDmTXoqRiQU6hjsdxyW9DBeG1vQx+a6Y8PZ+GS73dnCn9gvjs4vRPQ+xtEhFSVr5JP eb8jXc+/qLk9o4nTZCxgsHZK2yXBuG0WFqR4WW1/PbO4CAtQd6HpCT8rfuEZ40jN6+EL 7/FLb3PAq6XquGXzMa2jtGX8cq05uJ57QU5SENGaJTr42WGMrQHt0WE2f/V9dLvZ75bI wH/TVIlY+C1SsWIwc+lCyhsJW638AGuyPZibLZ7zGNs4hh4GseoDR3KfUr6RV5syXIuj NTerb35YFujIYjXzMngUPvQBGo0hfbKSVxadNf3oo0UJvUNrx6itRsxJEi0+Ra4U82AW gEIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Avl67Z0cyTYI8btTR81/Gr3wIhc7BtMos9AaUEaVDcI=; b=AUVgmDjuD/aorrJswXB79HtOQoAl0iGyORMOvTlgZRJ6tPNmKSkVkQHkrrLJ++ejrv B6nwF9JlXAW762wt5Zky2HXwG/7/3Iw/904SMKQtVEHb2UP3f5PaEbCGjuwhdQpQyswP EpXzW9a2HxK/vKK90TNluZremBpHvjPvssTXlwe3LEgC9Mf8SIyEE8CCCF0e0dtsQBNY ij6jP02A6DQ7GW61zGEvGPlGvrrHB4oub3vW6l/HreI2RubqHUym7LfdbW6dPWAhTxpV 6wm85KOWjFpy5b0a0c3gg4+lWqpVhKqSKC1uv3d9YjEmaKJfJgnvtvchadpwooFaN+/2 x6Dw== X-Gm-Message-State: AIkVDXKfrdyfO/EQMyYRlrSOlPR7ySIN6Qcjew39Eds49rDk8TkNyzzMfhzjPlv7SEjpjQ== X-Received: by 10.28.225.215 with SMTP id y206mr18528672wmg.138.1485289625134; Tue, 24 Jan 2017 12:27:05 -0800 (PST) Received: from emmanuel-Aspire-E5-571.primacom.net ([185.44.151.141]) by smtp.gmail.com with ESMTPSA id c132sm28107611wme.21.2017.01.24.12.27.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 12:27:04 -0800 (PST) From: Emmanuel Roullit To: david.marchand@6wind.com Cc: dev@dpdk.org, stable@dpdk.org Date: Tue, 24 Jan 2017 21:26:56 +0100 Message-Id: <20170124202656.792-1-emmanuel.roullit@gmail.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH] eal: reset driver name pointer on failure 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, 24 Jan 2017 20:27:05 -0000 The pointer set by strdup() needs to be cleared on failure to avoid a potential double-free from the caller. Found with clang static analysis: lib/librte_eal/common/eal_common_devargs.c:123:2: warning: Attempt to free released memory free(buf); ^~~~~~~~~ Fixes: 3fe2e5fec82b ("eal: fix argument parsing check") Signed-off-by: Emmanuel Roullit --- lib/librte_eal/common/eal_common_devargs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index e403717be..ffa8ad96f 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -72,6 +72,7 @@ rte_eal_parse_devargs_str(const char *devargs_str, if (*drvargs == NULL) { free(*drvname); + *drvname = NULL; return -1; } return 0; -- 2.11.0