summaryrefslogtreecommitdiff
path: root/filter/config.Y
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-03-19 09:41:18 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-03-19 09:41:18 +0100
commitaa4612480424ad2fede0cd4ae4c7a893f61c6c0f (patch)
tree8241b7e72a8eb2f243f566cd81b072ccdb8ca183 /filter/config.Y
parent74e9331fe0892c4c96b4c4d7db3f14bb7e9d928e (diff)
Clear local variables in filters and functions.
Fixes crash when used uninitialized variables. This problem was surprisingly tricky to fix.
Diffstat (limited to 'filter/config.Y')
-rw-r--r--filter/config.Y9
1 files changed, 8 insertions, 1 deletions
diff --git a/filter/config.Y b/filter/config.Y
index fcbee714..1af5649c 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -172,7 +172,14 @@ function_params:
function_body:
decls '{' cmds '}' {
- $$ = $3;
+ if ($1) {
+ /* Prepend instruction to clear local variables */
+ $$ = f_new_inst();
+ $$->code = P('c','v');
+ $$->a1.p = $1;
+ $$->next = $3;
+ } else
+ $$ = $3;
}
;