From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id A7FF67D4E for ; Wed, 17 Oct 2018 16:30:37 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id n11-v6so29870721wru.13 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=gQNw6f5ZTf1eiMId4sfD0LcCeRNp8v457+KHThHlWL5fE1VO46rxl3xDrq2hPhmXRD Ms2MTO8BJH/iExLZ0b6TJ1YAVDgsB5QFuKEyVTHOD+UGRZaVkZuQszdl6iK28D8+Tq7W iaH3EfOLfayDCgTocBI6S+nXrZp2QWT/qBpZh0tCYw685i8X5Fyxd2PyAolqA5wy1oe8 uyDLUPCWAvo1/cKe5pYyyZ3WNe0f3roc/YVgjXcb93ItMLVQ4R9H15SObVhI6CNdc2Xb F+L2T+xic9F/52oJlKM9+qKC41FyJ5GxGLGDA8j0O2yX11KSn7XA1N8TI6D0g9+Eusjk U/Ng== X-Gm-Message-State: ABuFfohkLpY1kk0IgElg5E/Hq1AvSmaW5hKh2nsArzl+//mDtKnpKsfd E93M90BvYbyHEvMuAktyYT6hng== 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-stable] [PATCH v1] devargs: fix variadic parsing memory leak X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 14:30:37 -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