mesa/main: free locale at exit

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>
This commit is contained in:
Erik Faye-Lund 2015-06-28 14:51:09 +02:00 committed by Matt Turner
parent c61bc6ed84
commit e566e5203a
3 changed files with 22 additions and 1 deletions

View File

@ -346,6 +346,16 @@ _mesa_destroy_visual( struct gl_config *vis )
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.
@ -385,7 +395,7 @@ one_time_init( struct gl_context *ctx )
_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) {

View File

@ -45,6 +45,14 @@ _mesa_locale_init(void)
#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 '.'

View File

@ -34,6 +34,9 @@ extern "C" {
extern void
_mesa_locale_init(void);
extern void
_mesa_locale_fini(void);
extern double
_mesa_strtod(const char *s, char **end);