From 1f375577f6965d64fe9c3ed5f210e87f51a00149 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Mon, 6 Apr 2020 12:51:55 -0400 Subject: [PATCH] pbrd: delete pbr nhg cache after rlease from hash Actually delete the allocated pbr_nhg_cache object we just released. Found via memory leak: ==3078405== 136 bytes in 1 blocks are definitely lost in loss record 8,282 of 8,802 ==3078405== at 0x483BB1A: calloc (vg_replace_malloc.c:762) ==3078405== by 0x48E35E8: qcalloc (memory.c:110) ==3078405== by 0x40EBA7: pbr_nhgc_alloc (pbr_nht.c:194) ==3078405== by 0x48CC0EB: hash_get (hash.c:148) ==3078405== by 0x40F825: pbr_nht_add_individual_nexthop (pbr_nht.c:534) ==3078405== by 0x409853: pbr_map_nexthop_magic (pbr_vty.c:400) ==3078405== by 0x4093F1: pbr_map_nexthop (pbr_vty_clippy.c:417) ==3078405== by 0x48ACF72: cmd_execute_command_real (command.c:1073) ==3078405== by 0x48ACB3B: cmd_execute_command (command.c:1133) ==3078405== by 0x48AD063: cmd_execute (command.c:1288) ==3078405== by 0x493D8EE: vty_command (vty.c:526) ==3078405== by 0x493D397: vty_execute (vty.c:1293) Signed-off-by: Stephen Worley --- pbrd/pbr_nht.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index ecd375333..8a0168924 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -564,6 +564,7 @@ void pbr_nht_delete_individual_nexthop(struct pbr_map_sequence *pbrms) pbr_nht_uninstall_nexthop_group(pnhgc, *pbrms->nhg, nh_type); hash_release(pbr_nhg_hash, pnhgc); + pbr_nhgc_delete(pnhgc); nexthop_group_delete(&pbrms->nhg); XFREE(MTYPE_TMP, pbrms->internal_nhg_name);