Free IncludePath when no longer needed Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
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_ */