Skip to content

Commit

Permalink
bgpd: Fix memory leak for default-originate with route-map
Browse files Browse the repository at this point in the history
```
Direct leak of 40 byte(s) in 1 object(s) allocated from:
    0 0x7fc4b81eed28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7fc4b7bd60bb in qcalloc lib/memory.c:105
    2 0x56221dc19207 in aspath_dup bgpd/bgp_aspath.c:689
    3 0x56221daacd42 in route_set_aspath_prepend bgpd/bgp_routemap.c:2283
    4 0x7fc4b7c3891a in route_map_apply_ext lib/routemap.c:2687
    5 0x56221dace552 in subgroup_default_originate bgpd/bgp_updgrp_adv.c:906
    6 0x56221dabf79c in update_group_default_originate_route_map_walkcb bgpd/bgp_updgrp.c:2105
    7 0x56221dabde4e in update_group_walkcb bgpd/bgp_updgrp.c:1721
    8 0x7fc4b7b9d398 in hash_walk lib/hash.c:270
    9 0x56221dac94cb in update_group_af_walk bgpd/bgp_updgrp.c:2062
    10 0x56221dac9b0f in update_group_walk bgpd/bgp_updgrp.c:2071
    11 0x56221dac9fd5 in update_group_refresh_default_originate_route_map bgpd/bgp_updgrp.c:2118
    12 0x7fc4b7c7fc54 in event_call lib/event.c:1974
    13 0x7fc4b7bb9276 in frr_run lib/libfrr.c:1214
    14 0x56221d9217fd in main bgpd/bgp_main.c:510
    15 0x7fc4b6bf2c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
```

tmp_pi.attr should be flushed since it's already interned (new_attr) or the
origin value is used (attr).

Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 committed Jan 8, 2024
1 parent d2fe193 commit 74c1d4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bgpd/bgp_updgrp_adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,8 @@ void subgroup_default_originate(struct update_subgroup *subgrp, bool withdraw)
bgp_attr_flush(new_attr);
new_attr = bgp_attr_intern(
tmp_pi.attr);
bgp_attr_flush(tmp_pi.attr);
}
bgp_attr_flush(tmp_pi.attr);
subgroup_announce_reset_nhop(
(peer_cap_enhe(peer, afi, safi)
? AF_INET6
Expand Down

0 comments on commit 74c1d4f

Please sign in to comment.