diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-08-09 17:37:01 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-08-09 17:37:01 +0000 |
| commit | 4427e9b3eeb6aaff3882dd1e96e14af62fa37ad4 (patch) | |
| tree | 1cb9919bd6e5b661f8b6900b2510109319ec0e68 /lib/command_parse.y | |
| parent | 1ab84bf32f891c9aa62e1d2a42501a0df7d6aec0 (diff) | |
lib: Fix various minor bugs
- cmd_make_strvec returns null pointer if str
begins with a '#'
- disallow options nested options
- NULL out state variable in parser
- flip backwards comparison
- fix memory leak in lexer
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_parse.y')
| -rw-r--r-- | lib/command_parse.y | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/command_parse.y b/lib/command_parse.y index 6b972afe90..51c2331dc7 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -41,7 +41,10 @@ yylex (void); extern void - set_buffer_string (const char *); + set_lexer_string (const char *); + + extern void + cleanup_lexer (void); } /* functionality this unit exports */ @@ -135,7 +138,7 @@ optnode_start = optnode_end = NULL; /* set string to parse */ - set_buffer_string (element->string); + set_lexer_string (element->string); /* copy docstring and keep a pointer to the copy */ docstr = element->doc ? XSTRDUP(MTYPE_TMP, element->doc) : NULL; @@ -341,7 +344,6 @@ selector_element_root: selector_token: selector_element_root -| option ; /* [option|set] productions */ @@ -368,6 +370,7 @@ option_element: add_node (optnode_start, seqhead); add_node ($1, optnode_end); + seqhead = NULL; } option_token_seq: @@ -412,6 +415,9 @@ cleanup() /* free resources */ free (docstr_start); + /* cleanup lexer */ + cleanup_lexer(); + /* clear state pointers */ seqhead = NULL; currnode = NULL; |
