summaryrefslogtreecommitdiffstats
path: root/lib/command_lex.l
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-07-29 17:54:03 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-07-29 17:54:03 +0200
commitde9d7e4f3ccb1b199602c1a1ce884df37e54f834 (patch)
tree7ecb990ffe55f28e5ce77a059c791f558e503130 /lib/command_lex.l
parentlib: Improve argv construction (diff)
downloadfrr-de9d7e4f3ccb1b199602c1a1ce884df37e54f834.tar.xz
frr-de9d7e4f3ccb1b199602c1a1ce884df37e54f834.zip
lib: Cleanup some memory issues in CLI
Various memory leaks have been fixed and the quagga memory macros are in use. Also consolidated the argv and matching code into one graph traversal. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_lex.l')
-rw-r--r--lib/command_lex.l14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/command_lex.l b/lib/command_lex.l
index 45f8f8e63..5a0e76d41 100644
--- a/lib/command_lex.l
+++ b/lib/command_lex.l
@@ -22,14 +22,14 @@ RANGE \({NUMBER}\-{NUMBER}\)
%%
[ /t] /* ignore whitespace */;
-{WORD} {yylval.string = strdup(yytext); return WORD;}
-{IPV4} {yylval.string = strdup(yytext); return IPV4;}
-{IPV4_PREFIX} {yylval.string = strdup(yytext); return IPV4_PREFIX;}
-{IPV6} {yylval.string = strdup(yytext); return IPV6;}
-{IPV6_PREFIX} {yylval.string = strdup(yytext); return IPV6_PREFIX;}
-{VARIABLE} {yylval.string = strdup(yytext); return VARIABLE;}
+{WORD} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return WORD;}
+{IPV4} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV4;}
+{IPV4_PREFIX} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV4_PREFIX;}
+{IPV6} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6;}
+{IPV6_PREFIX} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6_PREFIX;}
+{VARIABLE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;}
{NUMBER} {yylval.integer = atoi(yytext); return NUMBER;}
-{RANGE} {yylval.string = strdup(yytext); return RANGE;}
+{RANGE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;}
. {return yytext[0];}
%%