Commit d94d9b45223b3f99c8b75d634f486a5a56918d05

Ran Benita 2012-03-01T21:03:37

Free IncludePath when no longer needed Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index b4bac2b..50d3707 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -229,6 +229,7 @@ xkb_compile_keymap_from_components(const struct xkb_component_names * ktcsg)
 unwind_file:
     FreeXKBFile(file);
     free(scanFile);
+    XkbFreeIncludePath();
 fail:
     return xkb;
 }
@@ -268,6 +269,7 @@ compile_keymap(XkbFile *file, const char *mapName)
 unwind_file:
     FreeXKBFile(file);
     free(scanFile);
+    XkbFreeIncludePath();
     return xkb;
 }
 
diff --git a/src/xkbcomp/xkbpath.c b/src/xkbcomp/xkbpath.c
index 0839f88..a08d265 100644
--- a/src/xkbcomp/xkbpath.c
+++ b/src/xkbcomp/xkbpath.c
@@ -201,6 +201,14 @@ XkbClearIncludePath(void)
     noDefaultPath = True;
 }
 
+void
+XkbFreeIncludePath(void)
+{
+    XkbClearIncludePath();
+    free(includePath);
+    includePath = NULL;
+}
+
 /**
  * Add the given path to the global includePath variable.
  * If dir is NULL, the includePath is emptied.
diff --git a/src/xkbcomp/xkbpath.h b/src/xkbcomp/xkbpath.h
index 488999e..0273e9b 100644
--- a/src/xkbcomp/xkbpath.h
+++ b/src/xkbcomp/xkbpath.h
@@ -46,4 +46,6 @@ extern Bool XkbParseIncludeMap(char ** /* str_inout */ ,
                                char **  /* extra_data */
     );
 
+extern void XkbFreeIncludePath(void);
+
 #endif /* _XKBPATH_H_ */