DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/5] test: after NULL check, don't free the NULL pointer
Date: Tue, 16 Dec 2014 15:03:49 +0000	[thread overview]
Message-ID: <1418742233-16776-2-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1418742233-16776-1-git-send-email-bruce.richardson@intel.com>

In the kvargs test cases, we were checking for errors by checking if the
returned pointer value was NULL. In the error handling, we then tried to
free back the NULL pointer, which would cause a crash.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_kvargs.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/app/test/test_kvargs.c b/app/test/test_kvargs.c
index b8f5e5c..6be8512 100644
--- a/app/test/test_kvargs.c
+++ b/app/test/test_kvargs.c
@@ -78,7 +78,6 @@ static int test_valid_kvargs(void)
 	kvlist = rte_kvargs_parse(args, valid_keys);
 	if (kvlist == NULL) {
 		printf("rte_kvargs_parse() error");
-		rte_kvargs_free(kvlist);
 		goto fail;
 	}
 	rte_kvargs_free(kvlist);
@@ -89,7 +88,6 @@ static int test_valid_kvargs(void)
 	kvlist = rte_kvargs_parse(args, valid_keys);
 	if (kvlist == NULL) {
 		printf("rte_kvargs_parse() error");
-		rte_kvargs_free(kvlist);
 		goto fail;
 	}
 	/* call check_handler() for all entries with key="check" */
@@ -150,7 +148,6 @@ static int test_valid_kvargs(void)
 	kvlist = rte_kvargs_parse(args, valid_keys);
 	if (kvlist == NULL) {
 		printf("rte_kvargs_parse() error");
-		rte_kvargs_free(kvlist);
 		goto fail;
 	}
 	/* call check_handler() on all entries with key="check", it
-- 
1.9.3

  reply	other threads:[~2014-12-16 15:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 15:03 [dpdk-dev] [PATCH 0/5] Fixes for issues highlighted by static analysis scan Bruce Richardson
2014-12-16 15:03 ` Bruce Richardson [this message]
2014-12-16 15:03 ` [dpdk-dev] [PATCH 2/5] test: check for mbuf alloc failure Bruce Richardson
2014-12-16 15:03 ` [dpdk-dev] [PATCH 3/5] examples: set correct limit for length of unix socket path Bruce Richardson
2014-12-16 15:03 ` [dpdk-dev] [PATCH 4/5] examples: fix check for null before de-reference Bruce Richardson
2014-12-16 15:03 ` [dpdk-dev] [PATCH 5/5] cfgfile: prevent error when reading an empty file Bruce Richardson
2014-12-16 23:53 ` [dpdk-dev] [PATCH 0/5] Fixes for issues highlighted by static analysis scan 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=1418742233-16776-2-git-send-email-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.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).