From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B626C8019 for ; Tue, 16 Dec 2014 16:05:15 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 16 Dec 2014 07:01:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,587,1413270000"; d="scan'208";a="654916475" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 16 Dec 2014 07:03:54 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id sBGF3rZM008295; Tue, 16 Dec 2014 15:03:54 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id sBGF3rNB016822; Tue, 16 Dec 2014 15:03:53 GMT Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id sBGF3r2s016818; Tue, 16 Dec 2014 15:03:53 GMT From: Bruce Richardson To: dev@dpdk.org Date: Tue, 16 Dec 2014 15:03:49 +0000 Message-Id: <1418742233-16776-2-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1418742233-16776-1-git-send-email-bruce.richardson@intel.com> References: <1418742233-16776-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 1/5] test: after NULL check, don't free the NULL pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2014 15:05:18 -0000 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