diff options
author | John Southworth <john.southworth@vyatta.com> | 2012-06-03 10:29:41 -0700 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2012-06-03 10:29:41 -0700 |
commit | 4610ade056855f0e03457857d0f704c6d5b689f2 (patch) | |
tree | 32e5e8afca43ac814d7d087fb7d1161340375fdd /src/cparse/cparse_lex.l | |
parent | 6c4cf990bf4ea521f602a6d4e8ac4d51de461da9 (diff) | |
download | vyatta-cfg-4610ade056855f0e03457857d0f704c6d5b689f2.tar.gz vyatta-cfg-4610ade056855f0e03457857d0f704c6d5b689f2.zip |
Fix more load/commit memory leaks
This fixes some more of the memory leaks in load and commit.
Some still exist in the legacy cli_new/cli_parse code. Since that code
is supposed to be rewritten such that it interfaces with the rewritten
commit code in a clean way, these will not be fixed right now.
Diffstat (limited to 'src/cparse/cparse_lex.l')
-rw-r--r-- | src/cparse/cparse_lex.l | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cparse/cparse_lex.l b/src/cparse/cparse_lex.l index 61c016f..49f8d47 100644 --- a/src/cparse/cparse_lex.l +++ b/src/cparse/cparse_lex.l @@ -61,6 +61,18 @@ set_ret_str() str_ptr = str_buf; } +static void +free_str() +{ + free(str_buf); + free(out_buf); + node_deactivated = 0; + str_buf = NULL; + out_buf = NULL; + str_ptr = NULL; + str_buf_len = 0; +} + %} %% @@ -98,6 +110,7 @@ set_ret_str() ++tmp; } cparse_lval.str = strdup(tmp); + free_str(); BEGIN(INITIAL); return COMMENT; } @@ -170,6 +183,7 @@ set_ret_str() <sQStr>\" { set_ret_str(); cparse_lval.str = strdup(out_buf); + free_str(); BEGIN(sValue); return VALUE; } |