summaryrefslogtreecommitdiffstats
path: root/lib/command_parse.y
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-01-26 22:19:32 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2017-01-31 15:28:19 +0100
commit55b7f20fda27ad22d211e7b881194fc414687274 (patch)
tree1e3cbf91a98931632d5210c0a2990959874d42f0 /lib/command_parse.y
parentMerge branch 'frr/pull/133' ("Pim cleanup") (diff)
downloadfrr-55b7f20fda27ad22d211e7b881194fc414687274.tar.xz
frr-55b7f20fda27ad22d211e7b881194fc414687274.zip
lib: parser: fix allocation counting
command_lex.l was allocating as MTYPE_TMP, while command_parse.y would just call free(). Make both use MTYPE_LEX. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command_parse.y')
-rw-r--r--lib/command_parse.y19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/command_parse.y b/lib/command_parse.y
index e9d36ca41..1c220b6b6 100644
--- a/lib/command_parse.y
+++ b/lib/command_parse.y
@@ -46,10 +46,13 @@
%code requires {
#include "stdlib.h"
#include "string.h"
+ #include "memory.h"
#include "command.h"
#include "log.h"
#include "graph.h"
+ DECLARE_MTYPE(LEX)
+
#define YYSTYPE CMD_YYSTYPE
#define YYLTYPE CMD_YYLTYPE
struct parser_ctx;
@@ -216,7 +219,7 @@ simple_token:
literal_token: WORD
{
$$ = new_token_node (ctx, WORD_TKN, $1, doc_next(ctx));
- free ($1);
+ XFREE (MTYPE_LEX, $1);
}
;
@@ -224,27 +227,27 @@ placeholder_token:
IPV4
{
$$ = new_token_node (ctx, IPV4_TKN, $1, doc_next(ctx));
- free ($1);
+ XFREE (MTYPE_LEX, $1);
}
| IPV4_PREFIX
{
$$ = new_token_node (ctx, IPV4_PREFIX_TKN, $1, doc_next(ctx));
- free ($1);
+ XFREE (MTYPE_LEX, $1);
}
| IPV6
{
$$ = new_token_node (ctx, IPV6_TKN, $1, doc_next(ctx));
- free ($1);
+ XFREE (MTYPE_LEX, $1);
}
| IPV6_PREFIX
{
$$ = new_token_node (ctx, IPV6_PREFIX_TKN, $1, doc_next(ctx));
- free ($1);
+ XFREE (MTYPE_LEX, $1);
}
| VARIABLE
{
$$ = new_token_node (ctx, VARIABLE_TKN, $1, doc_next(ctx));
- free ($1);
+ XFREE (MTYPE_LEX, $1);
}
| RANGE
{
@@ -260,7 +263,7 @@ placeholder_token:
// validate range
if (token->min > token->max) cmd_yyerror (&@1, ctx, "Invalid range.");
- free ($1);
+ XFREE (MTYPE_LEX, $1);
}
/* <selector|set> productions */
@@ -332,6 +335,8 @@ selector: '[' selector_seq_seq ']'
#undef scanner
+DEFINE_MTYPE(LIB, LEX, "Lexer token (temporary)")
+
void
command_parse_format (struct graph *graph, struct cmd_element *cmd)
{