From 67c02c9449671a12bcaaaf71b06efd7989ebc026 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 13 Sep 2016 18:39:56 +0000 Subject: [PATCH] lib: Fix memory leak in matcher Signed-off-by: Quentin Young --- lib/command_match.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } -- 2.39.5