devargs: reset driver name pointer on parsing failure
authorEmmanuel Roullit <emmanuel.roullit@gmail.com>
Tue, 24 Jan 2017 20:26:56 +0000 (21:26 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 29 Jan 2017 22:34:07 +0000 (23:34 +0100)
commit3cdfdf2a3303bb50d98c4f1689fc4b3745ea1e4f
treeaebf704e2dd73cf47e4fd323f85bb73a1b84a89f
parentec7df18bb70ec6900892c6e47a29ce1cb2b07702
devargs: reset driver name pointer on parsing failure

The pointer set by strdup() needs to be cleared on failure to avoid a
potential double-free from the caller.

Found with clang static analysis:
lib/librte_eal/common/eal_common_devargs.c:123:2:
warning: Attempt to free released memory
        free(buf);
        ^~~~~~~~~

Fixes: 0fe11ec592b2 ("eal: add vdev init and uninit")

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
lib/librte_eal/common/eal_common_devargs.c