From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id DFB7B7EC7 for ; Wed, 17 Oct 2018 16:30:37 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id e4-v6so29965811wrs.0 for ; Wed, 17 Oct 2018 07:30:37 -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:mime-version :content-transfer-encoding; bh=VI9J87OAbUt9pLDn6H+fjpl7unkklMEEFYD8w+DfQdk=; b=SLndAr/ReFcPk/KplZCqfXdyWH2u8+JgTSOzHU5YPj8mguKZK8M8dKGN3p1axjn39K NGxUt3zxvBTsNpsWn6qcS9IpwCGOJnMyGYPbFN+ZggF9CmKnO84z3z+JYQLcG6+y13X3 NPSSUSHMjYgFjej0K7/C/OIlOZo2katlyFbajFEX35RnrsRgCNRm/XZ7UFmH70d20jhO IY0DiXFpyaM81hEXv58WA/7ggvL/3xkXH/bhTck9oynYI69bggQ553Ve4B5C7WjcQXdm Hznyxf21NW8TqBCcYdX0NF787+GjT1ogOBb0xaBm+1rZc/lzysklsW8SYEwYyEq9ROsc EHCQ== 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:mime-version :content-transfer-encoding; bh=VI9J87OAbUt9pLDn6H+fjpl7unkklMEEFYD8w+DfQdk=; b=XtT1GVJNfpKWpDe8rNEnoDygQF4hrD+RFzVLcdoUwmS8i7jku6VmwOTlSNX7cP1Z92 4fM8WCi2OMw+CDDKIPQLL+3GpG9fLAITDMt+d2rOsrf4tEB3v0onWSREQky0cz8j9YE3 kZUW7mRu3KQPinXfoAaAu0MYRHYjZtJwofDA688GUoBP1gVoOZimQo0WAHTqEF7bIqNF I26QT6N1+aAb2sBMjks5/4oTMkzdyky1uGQzZsxWjdzHMutQBxCtt5kBiG9C6BV1t+Pd y/ROts3n0ybVVa9nbTbgBOl8cg8EEcfUgM7PVILisDW3VwRXngXDVR29TCqxnX3GLGx/ GO1Q== X-Gm-Message-State: ABuFfoi2zLSAPQ/PzyZTPN+UOdq+pOPy1tPKFKEmkGSji04q6zfgadcE 1ssFP1IOLNC7GECziIUdWAuTNThibGY= X-Google-Smtp-Source: ACcGV61WAnsZJVkbYQHPCqXX/F7b4pAeO+3jVkR76wZpsmk5l7I5qtkZ8iC3hjkbOnk7oeK10p//uA== X-Received: by 2002:adf:f043:: with SMTP id t3-v6mr23064964wro.92.1539786636766; Wed, 17 Oct 2018 07:30:36 -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 k7-v6sm3202652wmf.22.2018.10.17.07.30.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 07:30:35 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet , stable@dpdk.org Date: Wed, 17 Oct 2018 16:30:13 +0200 Message-Id: <20181017143013.29434-1-gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1] devargs: fix variadic parsing memory leak 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: Wed, 17 Oct 2018 14:30:38 -0000 rte_devargs_parsef will leak memory each time it is called. The device string must be freed. Fixes: a23bc2c4e01b ("devargs: add non-variadic parsing function") CC: stable@dpdk.org Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_devargs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 69e9e32e9..c1b06095e 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -237,6 +237,7 @@ rte_devargs_parsef(struct rte_devargs *da, const char *format, ...) va_list ap; size_t len; char *dev; + int ret; if (da == NULL) return -EINVAL; @@ -255,7 +256,10 @@ rte_devargs_parsef(struct rte_devargs *da, const char *format, ...) vsnprintf(dev, len + 1, format, ap); va_end(ap); - return rte_devargs_parse(da, dev); + ret = rte_devargs_parse(da, dev); + + free(dev); + return ret; } int __rte_experimental -- 2.19.0