Free IncludePath when no longer needed
authorRan Benita <ran234@gmail.com>
Thu, 1 Mar 2012 19:03:37 +0000 (21:03 +0200)
committerRan Benita <ran234@gmail.com>
Sat, 3 Mar 2012 22:04:04 +0000 (00:04 +0200)
Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/xkbcomp.c
src/xkbcomp/xkbpath.c
src/xkbcomp/xkbpath.h

index b4bac2b..50d3707 100644 (file)
@@ -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;
 }
 
index 0839f88..a08d265 100644 (file)
@@ -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.
index 488999e..0273e9b 100644 (file)
@@ -46,4 +46,6 @@ extern Bool XkbParseIncludeMap(char ** /* str_inout */ ,
                                char **  /* extra_data */
     );
 
+extern void XkbFreeIncludePath(void);
+
 #endif /* _XKBPATH_H_ */