From d94d9b45223b3f99c8b75d634f486a5a56918d05 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 1 Mar 2012 21:03:37 +0200 Subject: [PATCH] Free IncludePath when no longer needed Signed-off-by: Ran Benita --- src/xkbcomp/xkbcomp.c | 2 ++ src/xkbcomp/xkbpath.c | 8 ++++++++ src/xkbcomp/xkbpath.h | 2 ++ 3 files changed, 12 insertions(+) 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_ */ -- 2.7.4