In order to save a small leak if mesa is continously loaded and
unloaded, let's free the locale when the shared object is unloaded.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
+/**
+ * Calls all the various one-time-fini functions in Mesa
+ */
+
+static void
+one_time_fini(void)
+{
+ _mesa_destroy_shader_compiler();
+ _mesa_locale_fini();
+}
/**
* Calls all the various one-time-init functions in Mesa.
_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
}
- atexit(_mesa_destroy_shader_compiler);
+ atexit(one_time_fini);
#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
if (MESA_VERBOSE != 0) {
#endif
}
+void
+_mesa_locale_fini(void)
+{
+#if defined(_GNU_SOURCE) && defined(HAVE_XLOCALE_H)
+ freelocale(loc);
+#endif
+}
+
/**
* Wrapper around strtod which uses the "C" locale so the decimal
* point is always '.'
extern void
_mesa_locale_init(void);
+extern void
+_mesa_locale_fini(void);
+
extern double
_mesa_strtod(const char *s, char **end);