ast-build: don't leak on OOM in BoolVarCreate Signed-off-by: Ran Benita <ran234@gmail.com>
diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c
index 11bc091..2a28436 100644
--- a/src/xkbcomp/ast-build.c
+++ b/src/xkbcomp/ast-build.c
@@ -303,8 +303,15 @@ VarCreate(ExprDef *name, ExprDef *value)
VarDef *
BoolVarCreate(xkb_atom_t ident, bool set)
{
- return VarCreate((ExprDef *) ExprCreateIdent(ident),
- (ExprDef *) ExprCreateBoolean(set));
+ ExprDef *name, *value;
+ if (!(name = ExprCreateIdent(ident))) {
+ return NULL;
+ }
+ if (!(value = ExprCreateBoolean(set))) {
+ FreeStmt((ParseCommon *) name);
+ return NULL;
+ }
+ return VarCreate(name, value);
}
InterpDef *