ef8e5447e3
Before the patch, a call to rte_kvargs_tokenize() resulted in a call to strdup() to allocate a modifiable copy of the argument string. This string was never freed, excepted in the error cases of rte_kvargs_tokenize() where rte_free() was wrongly called instead of free(). In other cases, freeing this string was impossible as the pointer not saved. This patch introduces rte_kvargs_free() in order to free the structure properly. The pointer to the duplicated string is now kept in the rte_kvargs structure. A call to rte_kvargs_parse() directly allocates the structure, making rte_kvargs_init() useless. The only drawback of this API change is that a key/value associations cannot be added to an existing kvlist. But it's not used today, and there is not obvious use case for that. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>