ast-build: make sure InterpDef is freeable
authorRan Benita <ran234@gmail.com>
Sun, 27 Jul 2014 11:24:20 +0000 (14:24 +0300)
committerRan Benita <ran234@gmail.com>
Sun, 27 Jul 2014 11:32:18 +0000 (14:32 +0300)
commit40f109af56493605410f2bea891779fbbfa3fda9
tree7f0f9cb87f1c25024556231325e0dcf501195054
parent37cf20c90635c8cce675393ce885376795b553ea
ast-build: make sure InterpDef is freeable

With the following two rules:

    InterpretDecl   :       INTERPRET InterpretMatch OBRACE
                                VarDeclList
                            CBRACE SEMI
                            { $2->def = $4; $$ = $2; }
                    ;

    InterpretMatch  :       KeySym PLUS Expr
                            { $$ = InterpCreate($1, $3); }
                    |       KeySym
                            { $$ = InterpCreate($1, NULL); }
                    ;

And the fact that InterpCreate doesn't initialize ->def, if the
VarDeclList fails, the %destructor tries to recursively free the
uninitialized ->def VarDef. So always initialize it.

That was the only problematic code in the parser for %destructor (I'm
pretty sure).

Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/ast-build.c
test/data/keymaps/syntax-error2.xkb [new file with mode: 0644]
test/filecomp.c