eal: fix devargs leak on multi-process detach request
authorDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Fri, 23 Nov 2018 14:11:07 +0000 (15:11 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 25 Nov 2018 12:32:01 +0000 (13:32 +0100)
commit29bf7e93baa3d53e1773f2cfdade8706da2bde51
treed1960c88163312bd491eca1b2bde52152557d916
parent494db286f37ddbb88cd5b9d84dd9b18d1a797e5c
eal: fix devargs leak on multi-process detach request

Device detach triggered through IPC leaked some memory.
It allocated a devargs objects just to use it for
parsing the devargs string in order to retrieve the
device name. Those devargs weren't passed anywhere
and were never freed.

First of all, let's put those devargs on the stack,
so they doesn't need to be freed. Then free the
additional arguments string as soon as it's allocated,
because we won't need it.

Fixes: ac9e4a17370f ("eal: support attach/detach shared device from secondary")

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
lib/librte_eal/common/hotplug_mp.c