kvargs: fix freeing behaviour for null
By convention free() functions should ignore NULL parameter. This patch add this behaviour for rte_kvargs_free(). Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
parent
5663c25dcc
commit
c34af7424e
@ -174,8 +174,12 @@ rte_kvargs_process(const struct rte_kvargs *kvlist,
|
|||||||
void
|
void
|
||||||
rte_kvargs_free(struct rte_kvargs *kvlist)
|
rte_kvargs_free(struct rte_kvargs *kvlist)
|
||||||
{
|
{
|
||||||
|
if (!kvlist)
|
||||||
|
return;
|
||||||
|
|
||||||
if (kvlist->str != NULL)
|
if (kvlist->str != NULL)
|
||||||
free(kvlist->str);
|
free(kvlist->str);
|
||||||
|
|
||||||
free(kvlist);
|
free(kvlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,8 @@ void rte_kvargs_free(struct rte_kvargs *kvlist);
|
|||||||
*
|
*
|
||||||
* For each key/value association that matches the given key, calls the
|
* For each key/value association that matches the given key, calls the
|
||||||
* handler function with the for a given arg_name passing the value on the
|
* handler function with the for a given arg_name passing the value on the
|
||||||
* dictionary for that key and a given extra argument.
|
* dictionary for that key and a given extra argument. If *kvlist* is NULL
|
||||||
|
* function does nothing.
|
||||||
*
|
*
|
||||||
* @param kvlist
|
* @param kvlist
|
||||||
* The rte_kvargs structure
|
* The rte_kvargs structure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user