From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by dpdk.org (Postfix) with ESMTP id 6B779325F for ; Thu, 3 Aug 2017 14:34:46 +0200 (CEST) Received: by mail-wr0-f175.google.com with SMTP id y43so5175113wrd.3 for ; Thu, 03 Aug 2017 05:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=6k0aUjZrK+XTlMwVegh7HW/dBsJCRN/j+5Gz5az3ncI=; b=cJDH+yPoQJbVLoStEBshDElAIHSRpMkhZ5DpmounqL1u45pWC4BwCStaPGCky9r/KP 4M+sC8SIs5h2ugMgaWBuFU7JQOp0crt2oMx6K///BKBqNyhbFMSzFxVfTHldjr1/crZM UXpG0B/YtgGD7pMVq6Ij7jKzpOgocmOl3cNqeO35OzYqpdx9c7nq6Z2hDk857LIH1u+r PxwmTiEv4CsczvCkec3+ToDn+8XYfwJ8K5ijUE8+t6OiKSvFQTNHwE0ycgWJy6lq/zpz 1iOdZgMnpyKRgj/wEBindtjM1lV3ysoTmRgbgHx4UBcNwGF0WoIdJ7+s9hzbmlcW88Nd pOJA== 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=6k0aUjZrK+XTlMwVegh7HW/dBsJCRN/j+5Gz5az3ncI=; b=qcQUuOzt7pXoXFDlyKudMszh5W4eyQnWl/lnpiIovusVO65e1qMOZXYXnAkc9wxjxD sb3OdkLt/0VljjphAm+ZHr4VCDPm+zg9if8xwMJz0EGyv4v7PAU7mR2UFTvW/avhGbl8 gL16UGi/GOxtOAPKcy/jfoBobS9taybEsTcG3Su/6rEHc8McgwjtJbbycdLaOSB7qfQE wlFccKbnftP/h7lqLn5bOwjwUPN3sEquhTNTqptihqhX0crFb70hbwC7nSHLIAVWGgRC EfkaJ4TJdy/bg5zGPIWy/wvWZ05vt+En2osqRbAvljUssoiHiAeYD7wRJZPjAQTc+dsW DVCg== X-Gm-Message-State: AIVw112KJw01yXNB+S08iVCtBhPddfzNDTLUyIhHNMn3k6f3FKTQivWX wKjBkw6FEKQ2/4d69JU= X-Received: by 10.223.150.208 with SMTP id u74mr1196118wrb.259.1501763685648; Thu, 03 Aug 2017 05:34:45 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id y12sm2299210wrb.39.2017.08.03.05.34.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Aug 2017 05:34:44 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 3 Aug 2017 14:34:31 +0200 Message-Id: <90dae107bf7e55ec42ae8223d5666a77bd9ddfe7.1501763614.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] eal: fix leak in hotplug add on parse error 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: Thu, 03 Aug 2017 12:34:46 -0000 If rte_eal_devargs_parse fails, the rte_devargs has not yet been inserted in the global list. When jumping to err_devarg, the removal fails and it is not properly freed. Free the allocated rte_devargs if its removal failed. Coverity issue: 158658 Fixes: 7e8b26650146 ("eal: fix hotplug add / remove") Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_dev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index d19232d..fc8a4d2 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -204,7 +204,10 @@ int rte_eal_hotplug_add(const char *busname, const char *devname, return 0; err_devarg: - rte_eal_devargs_remove(busname, devname); + if (rte_eal_devargs_remove(busname, devname)) { + free(da->args); + free(da); + } err_name: free(name); return ret; -- 2.1.4