From: Quentin Young Date: Tue, 13 Sep 2016 18:39:56 +0000 (+0000) Subject: lib: Fix memory leak in matcher X-Git-Tag: frr-3.0-branchpoint~129^2~232 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=67c02c9449671a12bcaaaf71b06efd7989ebc026;p=mirror%2Ffrr.git lib: Fix memory leak in matcher Signed-off-by: Quentin Young --- diff --git a/lib/command_match.c b/lib/command_match.c index ca2135a1c2..75780de2c5 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -94,7 +94,7 @@ command_match (struct graph *cmdgraph, // prepend a dummy token to match that pesky start node vector vvline = vector_init (vline->alloced + 1); - vector_set_index (vvline, 0, (void *) "dummy"); + vector_set_index (vvline, 0, (void *) XSTRDUP (MTYPE_TMP, "dummy")); memcpy (vvline->index + 1, vline->index, sizeof (void *) * vline->alloced); vvline->active = vline->active + 1; @@ -114,6 +114,11 @@ command_match (struct graph *cmdgraph, assert (*el); } + // free the leader token we alloc'd + XFREE (MTYPE_TMP, vector_slot (vvline, 0)); + // free vector + vector_free (vvline); + return matcher_rv; }