From d3ec0066e5ea0edd691b939806cd7b879ac6a32a 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 --- 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 4a5bc36198..0d305a7af1 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -284,7 +284,7 @@ void if_rmap_ctx_delete(struct if_rmap_ctx *ctx) listnode_delete(if_rmap_ctx_list, ctx); hash_clean_and_free(&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