diff options
author | mbkma <[email protected]> | 2021-03-17 23:30:26 +0100 |
---|---|---|
committer | Robert Antoni Buj Gelonch <[email protected]> | 2021-03-18 09:19:12 +0100 |
commit | 5fac0d4fec1d22bb9124bf5f219148c66d368e09 (patch) | |
tree | f7a11966cb335e2a8eda00f20f378b3ba8eb2a6c /src | |
parent | 8aab08d696282ff5c855ee22d2314fe5fcb3ad64 (diff) | |
download | mate-calc-5fac0d4fec1d22bb9124bf5f219148c66d368e09.tar.bz2 mate-calc-5fac0d4fec1d22bb9124bf5f219148c66d368e09.tar.xz |
mp-serializer: fix memory leaks reported by valgrind
Diffstat (limited to 'src')
-rw-r--r-- | src/mp-serializer.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mp-serializer.c b/src/mp-serializer.c index 366355f..af45944 100644 --- a/src/mp-serializer.c +++ b/src/mp-serializer.c @@ -637,14 +637,20 @@ mp_serializer_class_init(MpSerializerClass *klass) static void mp_serializer_init(MpSerializer *serializer) { - gchar *radix, *tsep; + gchar *radix, *utf8_radix, *tsep; serializer->priv = mp_serializer_get_instance_private (serializer); radix = nl_langinfo(RADIXCHAR); - serializer->priv->radix = radix ? g_utf8_get_char(g_locale_to_utf8(radix, -1, NULL, NULL, NULL)) : '.'; + utf8_radix = g_locale_to_utf8(radix, -1, NULL, NULL, NULL); + serializer->priv->radix = radix ? g_utf8_get_char(utf8_radix) : '.'; + g_free(utf8_radix); tsep = nl_langinfo(THOUSEP); if (tsep && tsep[0] != '\0') - serializer->priv->tsep = g_utf8_get_char(g_locale_to_utf8(tsep, -1, NULL, NULL, NULL)); + { + gchar *utf8_tsep = g_locale_to_utf8(tsep, -1, NULL, NULL, NULL); + serializer->priv->tsep = g_utf8_get_char(utf8_tsep); + g_free(utf8_tsep); + } else serializer->priv->tsep = ' '; serializer->priv->tsep_count = 3; |