From 96d074abe0eb523dec5724b8587b8fa6068a6fbf Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Thu, 6 Apr 2023 21:17:05 +0800 Subject: [PATCH] ripd: Fix memory leak for ripd's route-map When cleaning `ripd`, it should free `ctx->name` of `struct if_rmap_ctx`, not `ctx` itself. Otherwise, it will lead to memory leak. Signed-off-by: anlan_cs (cherry picked from commit d3ec0066e5ea0edd691b939806cd7b879ac6a32a) --- lib/if_rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 75bb26c09c..af26c7472c 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -299,7 +299,7 @@ void if_rmap_ctx_delete(struct if_rmap_ctx *ctx) listnode_delete(if_rmap_ctx_list, ctx); hash_clean(ctx->ifrmaphash, (void (*)(void *))if_rmap_free); if (ctx->name) - XFREE(MTYPE_IF_RMAP_CTX_NAME, ctx); + XFREE(MTYPE_IF_RMAP_CTX_NAME, ctx->name); XFREE(MTYPE_IF_RMAP_CTX, ctx); } -- 2.39.5