tst_if_free_name_index - Frees the dynamic memory that was allocated by if_nameindex()
To check that function if_freenameindex() can frees the dynamic memory that was allocated by if_nameindex().
./tst_if_free_name_index [-tooloption ...] -tooloption : v6api tool option
1. Get all interface names and indexes 2. Frees the dynamic memory that was allocated by if_nameindex() 3. The ptr argument is NULL and frees the dynamic memory
The argument ptr can not be NULL. NULL ptr argument will cause program segment fault.
RFC 3493
4.4 Free Memory
The following function frees the dynamic memory that was allocated by if_nameindex().
#include <net/if.h>
void if_freenameindex(struct if_nameindex *ptr);
The ptr argument shall be a pointer that was returned by if_nameindex(). After if_freenameindex() has been called, the application shall not use the array of which ptr is the address.