DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 3/3] app/test: fix devargs tests
Date: Fri, 13 Feb 2015 16:03:15 +0100	[thread overview]
Message-ID: <1423839795-29450-4-git-send-email-david.marchand@6wind.com> (raw)
In-Reply-To: <1423839795-29450-1-git-send-email-david.marchand@6wind.com>

Add missing free for devargs->args and fix tests.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 app/test/test_devargs.c |    6 ++++--
 app/test/test_pci.c     |    2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 3d9f7bc..08fb781 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -48,6 +48,8 @@ static void free_devargs_list(void)
 	while (!TAILQ_EMPTY(&devargs_list)) {
 		devargs = TAILQ_FIRST(&devargs_list);
 		TAILQ_REMOVE(&devargs_list, devargs, next);
+		if (devargs->args)
+			free(devargs->args);
 		free(devargs);
 	}
 }
@@ -92,7 +94,7 @@ test_devargs(void)
 	if (strncmp(devargs->virtual.drv_name, "eth_ring1",
 			sizeof(devargs->virtual.drv_name)) != 0)
 		goto fail;
-	if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args)) != 0)
+	if (!devargs->args || strcmp(devargs->args, "k1=val,k2=val2") != 0)
 		goto fail;
 	free_devargs_list();
 
@@ -105,7 +107,7 @@ test_devargs(void)
 		devargs->pci.addr.devid != 0 ||
 		devargs->pci.addr.function != 1)
 		goto fail;
-	if (strncmp(devargs->args, "", sizeof(devargs->args)) != 0)
+	if (devargs->args)
 		goto fail;
 	free_devargs_list();
 
diff --git a/app/test/test_pci.c b/app/test/test_pci.c
index 747d8b7..5530d99 100644
--- a/app/test/test_pci.c
+++ b/app/test/test_pci.c
@@ -139,6 +139,8 @@ static void free_devargs_list(void)
 	while (!TAILQ_EMPTY(&devargs_list)) {
 		devargs = TAILQ_FIRST(&devargs_list);
 		TAILQ_REMOVE(&devargs_list, devargs, next);
+		if (devargs->args)
+			free(devargs->args);
 		free(devargs);
 	}
 }
-- 
1.7.10.4

  parent reply	other threads:[~2015-02-13 15:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 13:03 [dpdk-dev] [PATCH 0/2] remove limit on devargs parameters length David Marchand
2015-01-07 13:03 ` [dpdk-dev] [PATCH 1/2] devargs: indent and cleanup David Marchand
2015-01-07 13:03 ` [dpdk-dev] [PATCH 2/2] devargs: remove limit on parameters length David Marchand
2015-01-07 22:59   ` Stephen Hemminger
2015-01-08  8:19     ` David Marchand
2015-01-08  9:15     ` Panu Matilainen
2015-02-13 15:03 ` [dpdk-dev] [PATCH v2 0/3] remove limit on devargs " David Marchand
2015-02-13 15:03   ` [dpdk-dev] [PATCH v2 1/3] devargs: indent and cleanup David Marchand
2015-02-13 15:03   ` [dpdk-dev] [PATCH v2 2/3] devargs: remove limit on parameters length David Marchand
2015-02-13 15:03   ` David Marchand [this message]
2015-02-18 12:44   ` [dpdk-dev] [PATCH v2 0/3] remove limit on devargs " Thomas Monjalon

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=1423839795-29450-4-git-send-email-david.marchand@6wind.com \
    --to=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    /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).