]> git.puffer.fish Git - mirror/frr.git/commitdiff
ripd: Fix memory leak for ripd's route-map 13257/head
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 75bb26c09c918c06c39ed2f32729048214ecd296..af26c7472c4d62aa3c9d1624a096423dfa41ec0e 100644 (file)
@@ -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);
 }