DPDK patches and discussions
 help / color / mirror / Atom feed
From: Conor Walsh <conor.walsh@intel.com>
To: bruce.richardson@intel.com, ciara.power@intel.com, keith.wiles@intel.com
Cc: dev@dpdk.org, Conor Walsh <conor.walsh@intel.com>,
	Zhihong Peng <zhihongx.peng@intel.com>,
	Conor Fogarty <conor.fogarty@intel.com>
Subject: [dpdk-dev] [PATCH] eal: fix memory leak when saving arguments
Date: Wed,  1 Sep 2021 09:38:47 +0000	[thread overview]
Message-ID: <20210901093847.2269921-1-conor.walsh@intel.com> (raw)

This patch fixes a memleak which was reported in Bugzilla within the
eal_save_args function. This was caused by the function mistakenly
adding -- to the eal args instead of breaking beforehand.

Bugzilla ID: 722
Fixes: 293c53d8b23c ("eal: add telemetry callbacks")

Reported-by: Zhihong Peng <zhihongx.peng@intel.com>
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Signed-off-by: Conor Fogarty <conor.fogarty@intel.com>
---
 lib/eal/common/eal_common_options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index ff5861b5f3..bee716a714 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -229,9 +229,9 @@ eal_save_args(int argc, char **argv)
 		return -1;
 
 	for (i = 0; i < argc; i++) {
-		eal_args[i] = strdup(argv[i]);
 		if (strcmp(argv[i], "--") == 0)
 			break;
+		eal_args[i] = strdup(argv[i]);
 	}
 	eal_args[i++] = NULL; /* always finish with NULL */
 
-- 
2.25.1


             reply	other threads:[~2021-09-01  9:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  9:38 Conor Walsh [this message]
2021-09-01  9:59 ` Bruce Richardson
2021-09-16 20:22   ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210901093847.2269921-1-conor.walsh@intel.com \
    --to=conor.walsh@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=ciara.power@intel.com \
    --cc=conor.fogarty@intel.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    --cc=zhihongx.peng@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).