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 698E8595A for ; Mon, 2 Mar 2015 12:12:43 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 02 Mar 2015 03:10:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,675,1418112000"; d="scan'208";a="692638470" Received: from unknown (HELO Sent) ([10.217.248.233]) by orsmga002.jf.intel.com with SMTP; 02 Mar 2015 03:12:39 -0800 Received: by Sent (sSMTP sendmail emulation); Mon, 02 Mar 2015 12:09:25 +0100 From: Pawel Wodkowski To: dev@dpdk.org Date: Mon, 2 Mar 2015 12:09:22 +0100 Message-Id: <1425294562-26015-1-git-send-email-pawelx.wodkowski@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] eal: prevent dereferencing NULL pointer in rte_eal_devargs_add() 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: Mon, 02 Mar 2015 11:12:43 -0000 On failure devargs->args should not be accesed if devargs is NULL. Signed-off-by: Pawel Wodkowski --- lib/librte_eal/common/eal_common_devargs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 9b110f7..615945e 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -124,12 +124,13 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) return 0; fail: - if (devargs->args) - free(devargs->args); if (buf) free(buf); - if (devargs) + if (devargs) { + free(devargs->args); free(devargs); + } + return -1; } -- 1.9.1