From: Pawel Wodkowski Date: Mon, 2 Mar 2015 11:09:22 +0000 (+0100) Subject: devargs: fix null dereferencing on failure X-Git-Tag: spdx-start~9510 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a001589ec1d7ac0abd6eb382db09d755c5a456f8;p=dpdk.git devargs: fix null dereferencing on failure On failure devargs->args should not be accessed if devargs is NULL. Fixes: c07691ae1089 ("devargs: remove limit on parameters length") Signed-off-by: Pawel Wodkowski Acked-by: David Marchand --- diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 9b110f7cf1..615945e2ac 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; }