summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorErik Faye-Lund <kusmabite@gmail.com>2015-06-28 14:51:09 +0200
committerMatt Turner <mattst88@gmail.com>2015-06-29 09:06:40 -0700
commite566e5203aaba98109a67766cf28991de3358490 (patch)
tree0b9977766f1c16225637fb96d7c72e7e556ac444 /src/util
parentc61bc6ed844b39e600cc64e3e552c7bf1894d7ba (diff)
downloadexternal_mesa3d-e566e5203aaba98109a67766cf28991de3358490.zip
external_mesa3d-e566e5203aaba98109a67766cf28991de3358490.tar.gz
external_mesa3d-e566e5203aaba98109a67766cf28991de3358490.tar.bz2
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>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/strtod.c8
-rw-r--r--src/util/strtod.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/util/strtod.c b/src/util/strtod.c
index a4a60e0..ea7d395 100644
--- a/src/util/strtod.c
+++ b/src/util/strtod.c
@@ -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 '.'
diff --git a/src/util/strtod.h b/src/util/strtod.h
index b7e2beb..60e15cf 100644
--- a/src/util/strtod.h
+++ b/src/util/strtod.h
@@ -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);