diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-09-13 18:39:56 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-09-13 18:39:56 +0000 |
| commit | 67c02c9449671a12bcaaaf71b06efd7989ebc026 (patch) | |
| tree | ef2fd003244015262c96379e0662b8dc633534aa /lib/command_match.c | |
| parent | ee761cc086a1cbee6dd705fece71cb004b215e21 (diff) | |
lib: Fix memory leak in matcher
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_match.c')
| -rw-r--r-- | lib/command_match.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; } |
