Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babeld: Free IPv4 Memory in babel_interface_free #14807

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

Keelan10
Copy link
Contributor

Ensure proper memory cleanup by freeing the babel_ifp->ipv4 when babel interface is deleted. This prevents memory leaks.

The ASan leak log for reference:

***********************************************************************************
Address Sanitizer Error detected in all_protocol_startup.test_all_protocol_startup/r1.asan.babeld.4141

=================================================================
==4141==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 10 object(s) allocated from:
    #0 0x7f1cde6a9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x562b8eff328d in babel_interface_address_add babeld/babel_interface.c:112
    #2 0x7f1cde1772cb in zclient_read lib/zclient.c:4425
    #3 0x7f1cde14729c in event_call lib/event.c:1980
    #4 0x7f1cde08a3bf in frr_run lib/libfrr.c:1214
    #5 0x562b8eff481b in main babeld/babel_main.c:202
    #6 0x7f1cdd8acc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 40 byte(s) leaked in 10 allocation(s).
***********************************************************************************

Ensure proper memory cleanup by freeing the `babel_ifp->ipv4` when
babel interface is deleted. This prevents memory leaks.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in all_protocol_startup.test_all_protocol_startup/r1.asan.babeld.4141

=================================================================
==4141==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 10 object(s) allocated from:
    #0 0x7f1cde6a9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    FRRouting#1 0x562b8eff328d in babel_interface_address_add babeld/babel_interface.c:112
    FRRouting#2 0x7f1cde1772cb in zclient_read lib/zclient.c:4425
    FRRouting#3 0x7f1cde14729c in event_call lib/event.c:1980
    FRRouting#4 0x7f1cde08a3bf in frr_run lib/libfrr.c:1214
    FRRouting#5 0x562b8eff481b in main babeld/babel_main.c:202
    FRRouting#6 0x7f1cdd8acc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 40 byte(s) leaked in 10 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <[email protected]>
@Keelan10 Keelan10 force-pushed the fix-babel-int-delete-leak branch from 2ec0ea8 to 419cc23 Compare November 15, 2023 22:09
@ton31337 ton31337 merged commit c599ed5 into FRRouting:master Nov 16, 2023
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants