diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2025-02-04 15:00:12 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2025-02-04 15:00:12 -0500 |
| commit | 29dcfd415f8e1de6514ce3f9d61bd10e17b59bc6 (patch) | |
| tree | fa0b656aab6ea74e4ee45bff880d87cc2ef70e8b /zebra | |
| parent | f74fa9543bf66ec69c267099a4c3e045d58c94ba (diff) | |
zebra: Stop leaking labels when receiving nexthops from kernel
This leak is happening:
Direct leak of 96 byte(s) in 2 object(s) allocated from:
0 0x7f6922eb83b7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
1 0x7f6922a38ebb in qcalloc lib/memory.c:106
2 0x7f6922a553d6 in nexthop_add_srv6_seg6 lib/nexthop.c:652
3 0x562825e56b38 in parse_nexthop_unicast zebra/rt_netlink.c:589
4 0x562825e58c4a in netlink_route_change_read_unicast_internal zebra/rt_netlink.c:1291
5 0x562825e58eef in netlink_route_change_read_unicast zebra/rt_netlink.c:1321
6 0x562825e64921 in netlink_route_change zebra/rt_netlink.c:1494
7 0x562825e43407 in netlink_information_fetch zebra/kernel_netlink.c:407
8 0x562825e439b5 in netlink_parse_info zebra/kernel_netlink.c:1148
9 0x562825e44060 in kernel_read zebra/kernel_netlink.c:510
10 0x7f6922aeca72 in event_call lib/event.c:1984
11 0x7f6922a19e01 in frr_run lib/libfrr.c:1246
12 0x562825e4b0b9 in main zebra/main.c:543
13 0x7f692250c249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Just check to see if it has been allocated. The nexthop is a stack
variable so it's a bit odd.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra')
| -rw-r--r-- | zebra/rt_netlink.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index d696b19859..b6de0a6baa 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1295,6 +1295,9 @@ static int netlink_route_change_read_unicast_internal(struct nlmsghdr *h, flags, &p, (struct prefix_ipv6 *)&src_p, &nh, 0, table, metric, distance, true); + + if (nh.nh_label) + nexthop_del_labels(&nh); } else { /* XXX: need to compare the entire list of * nexthops here for NLM_F_APPEND stupidity */ |
