mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 04:23:00 +00:00
zebra: Fix nexthop group memory leak
Address Sanitizer found this: ================================================================= ==418623==ERROR: LeakSanitizer: detected memory leaks Direct leak of 128 byte(s) in 4 object(s) allocated from: #0 0x4bd732 in calloc (/usr/lib/frr/zebra+0x4bd732) #1 0x7feaeab8f798 in qcalloc /home/sharpd/frr8/lib/memory.c:116:27 #2 0x7feaeaba40f4 in nexthop_group_new /home/sharpd/frr8/lib/nexthop_group.c:270:9 #3 0x56859b in netlink_route_change_read_unicast /home/sharpd/frr8/zebra/rt_netlink.c:950:9 #4 0x5651c2 in netlink_route_change /home/sharpd/frr8/zebra/rt_netlink.c:1204:2 #5 0x54af15 in netlink_information_fetch /home/sharpd/frr8/zebra/kernel_netlink.c:407:10 #6 0x53e7a3 in netlink_parse_info /home/sharpd/frr8/zebra/kernel_netlink.c:1184:12 #7 0x548d46 in kernel_read /home/sharpd/frr8/zebra/kernel_netlink.c:501:2 #8 0x7feaeacc87f6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2 #9 0x7feaeab36503 in frr_run /home/sharpd/frr8/lib/libfrr.c:1198:3 #10 0x550d38 in main /home/sharpd/frr8/zebra/main.c:476:2 #11 0x7feaea492d09 in __libc_start_main csu/../csu/libc-start.c:308:16 Indirect leak of 576 byte(s) in 4 object(s) allocated from: #0 0x4bd732 in calloc (/usr/lib/frr/zebra+0x4bd732) #1 0x7feaeab8f798 in qcalloc /home/sharpd/frr8/lib/memory.c:116:27 #2 0x7feaeab9b3f8 in nexthop_new /home/sharpd/frr8/lib/nexthop.c:373:7 #3 0x56875e in netlink_route_change_read_unicast /home/sharpd/frr8/zebra/rt_netlink.c:960:15 #4 0x5651c2 in netlink_route_change /home/sharpd/frr8/zebra/rt_netlink.c:1204:2 #5 0x54af15 in netlink_information_fetch /home/sharpd/frr8/zebra/kernel_netlink.c:407:10 #6 0x53e7a3 in netlink_parse_info /home/sharpd/frr8/zebra/kernel_netlink.c:1184:12 #7 0x548d46 in kernel_read /home/sharpd/frr8/zebra/kernel_netlink.c:501:2 #8 0x7feaeacc87f6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2 #9 0x7feaeab36503 in frr_run /home/sharpd/frr8/lib/libfrr.c:1198:3 #10 0x550d38 in main /home/sharpd/frr8/zebra/main.c:476:2 #11 0x7feaea492d09 in __libc_start_main csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: 704 byte(s) leaked in 8 allocation(s). Fix this! Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
6f83bbd614
commit
478c62e21d
@ -987,10 +987,12 @@ int netlink_route_change_read_unicast_internal(struct nlmsghdr *h,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nhe_id || ng)
|
||||
if (nhe_id || ng) {
|
||||
dplane_rib_add_multipath(afi, SAFI_UNICAST, &p, &src_p,
|
||||
re, ng, startup, ctx);
|
||||
else {
|
||||
if (ng)
|
||||
nexthop_group_delete(&ng);
|
||||
} else {
|
||||
/*
|
||||
* I really don't see how this is possible
|
||||
* but since we are testing for it let's
|
||||
|
Loading…
Reference in New Issue
Block a user