dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eal: prevent dereferencing NULL pointer in rte_eal_devargs_add()
@ 2015-03-02 11:09 Pawel Wodkowski
       [not found] ` <1425294562-26015-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Pawel Wodkowski @ 2015-03-02 11:09 UTC (permalink / raw)
  To: dev-VfR2kkLFssw

On failure devargs->args should not be accesed if devargs is NULL.

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-02 18:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-02 11:09 [PATCH] eal: prevent dereferencing NULL pointer in rte_eal_devargs_add() Pawel Wodkowski
     [not found] ` <1425294562-26015-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-02 12:23   ` David Marchand
     [not found]     ` <CALwxeUuE1AjtZVpJrkJuXt6eGKEt97Rhi+-9OLC+=iuc+6FWWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-02 14:40       ` Wiles, Keith
     [not found]         ` <D119D21B.158BA%keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-02 14:55           ` Pawel Wodkowski
     [not found]             ` <54F479EF.4010706-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-02 16:47               ` Wiles, Keith
     [not found]                 ` <D119ED28.1590C%keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-02 17:35                   ` Pawel Wodkowski
2015-03-02 18:39       ` Thomas Monjalon

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).