Commit 7a87c202b70d6b0b5b5cedea5d49ace3c4c15535

Ran Benita 2014-09-10T13:10:33

ast-build: fix leak in error path Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c
index 58c482c..7fd92a6 100644
--- a/src/xkbcomp/ast-build.c
+++ b/src/xkbcomp/ast-build.c
@@ -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 *