Module: sip-router Branch: master Commit: c5e8ac5603f5a770b2306cd0d574c20586d788ad URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c5e8ac56...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Fri Jul 17 18:15:44 2009 +0200
core: config parser minor fix
- use a pkg_malloc'ed copy of yy_number_str for host_if_id - always free ID/NUM_ID/host_if_id after copying them (bug introduced in the last merge)
---
cfg.y | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/cfg.y b/cfg.y index a70c56c..51df90e 100644 --- a/cfg.y +++ b/cfg.y @@ -1932,6 +1932,7 @@ host: } pkg_free($1); } + if ($3) pkg_free($3); } | host MINUS ID { if ($1){ @@ -1947,6 +1948,7 @@ host: } pkg_free($1); } + if ($3) pkg_free($3); } | host DOT error { $$=0; pkg_free($1); yyerror("invalid hostname"); } | host MINUS error { $$=0; pkg_free($1); yyerror("invalid hostname"); } @@ -1954,7 +1956,12 @@ host:
host_if_id: ID | NUM_ID - | NUMBER { $$=yy_number_str /* text version */; } + | NUMBER { + /* get string version */ + $$=pkg_malloc(strlen(yy_number_str)+1); + if ($$) + strcpy($$, yy_number_str); + } ;
host_or_if: @@ -1973,6 +1980,7 @@ host_or_if: } pkg_free($1); } + if ($3) pkg_free($3); } | host_or_if MINUS host_if_id { if ($1){ @@ -1988,6 +1996,7 @@ host_or_if: } pkg_free($1); } + if ($3) pkg_free($3); } | host_or_if DOT error { $$=0; pkg_free($1); yyerror("invalid host or interface name"); }