ast-build: fix leak in error path

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2014-09-10 13:10:33 +03:00
parent ba98562909
commit 7a87c202b7
1 changed files with 7 additions and 1 deletions

View File

@ -304,6 +304,7 @@ VarDef *
BoolVarCreate(xkb_atom_t ident, bool set)
{
ExprDef *name, *value;
VarDef *def;
if (!(name = ExprCreateIdent(ident))) {
return NULL;
}
@ -311,7 +312,12 @@ BoolVarCreate(xkb_atom_t ident, bool set)
FreeStmt((ParseCommon *) name);
return NULL;
}
return VarCreate(name, value);
if (!(def = VarCreate(name, value))) {
FreeStmt((ParseCommon *) name);
FreeStmt((ParseCommon *) value);
return NULL;
}
return def;
}
InterpDef *