Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ospf6d: Free Newly Created LSA when Non-Self-Originated Grace LSA is …
…Discarded The newly created LSA `new` is now properly freed to prevent memory leaks when a non-self-originated Grace LSA which is not in LSDB is received. The ASan leak log for reference: ``` Direct leak of 400 byte(s) in 2 object(s) allocated from: #0 0x7f70e984bd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) sonic-net#1 0x7f70e92481c5 in qcalloc lib/memory.c:105 sonic-net#2 0x55b35068c975 in ospf6_lsa_alloc ospf6d/ospf6_lsa.c:710 sonic-net#3 0x55b35068c9f9 in ospf6_lsa_create ospf6d/ospf6_lsa.c:725 sonic-net#4 0x55b35065ab2c in ospf6_receive_lsa ospf6d/ospf6_flood.c:912 sonic-net#5 0x55b3506a1413 in ospf6_lsupdate_recv ospf6d/ospf6_message.c:1621 sonic-net#6 0x55b3506a1413 in ospf6_read_helper ospf6d/ospf6_message.c:1896 sonic-net#7 0x55b3506a1413 in ospf6_receive ospf6d/ospf6_message.c:1925 sonic-net#8 0x7f70e92e6ccb in event_call lib/event.c:1979 sonic-net#9 0x7f70e922b488 in frr_run lib/libfrr.c:1213 sonic-net#10 0x55b35064345e in main ospf6d/ospf6_main.c:250 sonic-net#11 0x7f70e8843c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) Indirect leak of 72 byte(s) in 2 object(s) allocated from: #0 0x7f70e984bb40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40) sonic-net#1 0x7f70e9247ee5 in qmalloc lib/memory.c:100 sonic-net#2 0x55b35068c987 in ospf6_lsa_alloc ospf6d/ospf6_lsa.c:711 sonic-net#3 0x55b35068c9f9 in ospf6_lsa_create ospf6d/ospf6_lsa.c:725 sonic-net#4 0x55b35065ab2c in ospf6_receive_lsa ospf6d/ospf6_flood.c:912 sonic-net#5 0x55b3506a1413 in ospf6_lsupdate_recv ospf6d/ospf6_message.c:1621 sonic-net#6 0x55b3506a1413 in ospf6_read_helper ospf6d/ospf6_message.c:1896 sonic-net#7 0x55b3506a1413 in ospf6_receive ospf6d/ospf6_message.c:1925 sonic-net#8 0x7f70e92e6ccb in event_call lib/event.c:1979 sonic-net#9 0x7f70e922b488 in frr_run lib/libfrr.c:1213 sonic-net#10 0x55b35064345e in main ospf6d/ospf6_main.c:250 sonic-net#11 0x7f70e8843c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) SUMMARY: AddressSanitizer: 472 byte(s) leaked in 4 allocation(s). ``` Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
- Loading branch information