devargs: fix null dereferencing on failure

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

Fixes: c07691ae10 ("devargs: remove limit on parameters length")

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
This commit is contained in:
Pawel Wodkowski 2015-03-02 12:09:22 +01:00 committed by Thomas Monjalon
parent c3615e4a80
commit a001589ec1

View File

@ -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;
}