From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: [PATCH 1/5] test: after NULL check, don't free the NULL pointer Date: Tue, 16 Dec 2014 15:03:49 +0000 Message-ID: <1418742233-16776-2-git-send-email-bruce.richardson@intel.com> References: <1418742233-16776-1-git-send-email-bruce.richardson@intel.com> To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1418742233-16776-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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 --- 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