From ca317cb7bd17792ff9f16a3c0eb49e11e963c63f Mon Sep 17 00:00:00 2001
From: luochunsheng <luochunsheng@huawei.com>
Date: Sat, 13 Apr 2019 16:24:11 +0800
Subject: [PATCH] Subject: [PATCH] Fix memory leak

---
 src/libkeymap/parser.y | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/libkeymap/parser.y b/src/libkeymap/parser.y
index d9efbf8..50c4f14 100644
--- a/src/libkeymap/parser.y
+++ b/src/libkeymap/parser.y
@@ -11,6 +11,7 @@
  */
 %{
 #define YY_HEADER_EXPORT_START_CONDITIONS 1
+#define YY_YY_Y_TAB_H_INCLUDED 1
 
 #include "config.h"
 #include "nls.h"
@@ -411,7 +412,6 @@ lk_parse_keymap(struct lk_ctx *ctx, lkfile_t *f)
 
 	ctx->mod = 0;
 
-	yylex_init(&scanner);
 	yylex_init_extra(ctx, &scanner);
 
 	INFO(ctx, _("Loading %s"), f->pathname);
@@ -424,8 +424,9 @@ lk_parse_keymap(struct lk_ctx *ctx, lkfile_t *f)
 
 	rc = 0;
 
+fail:
 	stack_pop(ctx, scanner);
 
- fail:	yylex_destroy(scanner);
+ 	yylex_destroy(scanner);
 	return rc;
 }
-- 
1.8.3.1

