diff mbox series

eal: fix memory leak when saving arguments

Message ID 20210901093847.2269921-1-conor.walsh@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers show
Series eal: fix memory leak when saving arguments | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/checkpatch success coding style OK

Commit Message

Conor Walsh Sept. 1, 2021, 9:38 a.m. UTC
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(-)

Comments

Bruce Richardson Sept. 1, 2021, 9:59 a.m. UTC | #1
On Wed, Sep 01, 2021 at 09:38:47AM +0000, Conor Walsh wrote:
> 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>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
David Marchand Sept. 16, 2021, 8:22 p.m. UTC | #2
On Wed, Sep 1, 2021 at 11:59 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Wed, Sep 01, 2021 at 09:38:47AM +0000, Conor Walsh wrote:
> > 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>
> > ---
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks.
diff mbox series

Patch

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 */