In `read_dev_mcast`, the list of ma_info is allocated, but not cleared
after use. Free the list in the end to make valgrind happy.
Detected by valgrind: "valgrind ./ip/ip maddr show"
Signed-off-by: Maxim Petrov <mmrmaximuzz@gmail.com>
*lst = m;
}
+static void maddr_clear(struct ma_info *lst)
+{
+ struct ma_info *mp;
+
+ while ((mp = lst) != NULL) {
+ lst = mp->next;
+ free(mp);
+ }
+}
+
static void read_dev_mcast(struct ma_info **result_p)
{
char buf[256];
if (!filter.family || filter.family == AF_INET6)
read_igmp6(&list);
print_mlist(stdout, list);
+ maddr_clear(list);
return 0;
}