]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ripd: Fix memory leak for ripd's route-map
authoranlan_cs <vic.lan@pica8.com>
Thu, 6 Apr 2023 13:17:05 +0000 (21:17 +0800)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 11 Apr 2023 11:38:25 +0000 (11:38 +0000)
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 <vic.lan@pica8.com>
(cherry picked from commit d3ec0066e5ea0edd691b939806cd7b879ac6a32a)

lib/if_rmap.c

index 8282e476dfac191bd5d0dd0ef10518f5d18d54a2..bd66ffae95e7bfb1c727e51c0cf8c9bc9dedec8e 100644 (file)
@@ -293,7 +293,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);
 }