From: anlan_cs Date: Thu, 6 Apr 2023 13:17:05 +0000 (+0800) Subject: ripd: Fix memory leak for ripd's route-map X-Git-Tag: docker/8.5.1~11^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F13257%2Fhead;p=mirror%2Ffrr.git 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) --- 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); }