[libgsf] ms-utils: fix ownership of memory.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsf] ms-utils: fix ownership of memory.
- Date: Sat, 1 Mar 2014 01:23:43 +0000 (UTC)
commit e054f2d636879c821c5846ac15f96bf2103492c3
Author: Morten Welinder <terra gnome org>
Date: Fri Feb 28 19:51:13 2014 -0500
ms-utils: fix ownership of memory.
If WINDOWS_LANGUAGE was set, memory handling was wrong.
NEWS | 1 +
gsf/gsf-msole-utils.c | 12 ++++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index c024e2f..f4d3cbe 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Allin Cottrell:
Morten:
* Fix translation issue and leak. [#706937]
* Fix fuzzed ods file crash. [#720458]
+ * Fix invalid g_free for Windows.
--------------------------------------------------------------------------
libgsf 1.14.28
diff --git a/gsf/gsf-msole-utils.c b/gsf/gsf-msole-utils.c
index e74c8bb..3d4dbcd 100644
--- a/gsf/gsf-msole-utils.c
+++ b/gsf/gsf-msole-utils.c
@@ -2290,16 +2290,20 @@ gsf_msole_lid_to_codepage_str (guint lid)
int
gsf_msole_iconv_win_codepage (void)
{
- char *lang;
+ const char *win_lang;
+ char *lang = NULL;
- if ((lang = getenv("WINDOWS_LANGUAGE")) == NULL) {
+ win_lang = g_getenv("WINDOWS_LANGUAGE");
+ if (win_lang) {
+ lang = g_strdup (win_lang);
+ } else {
char const *locale = setlocale (LC_CTYPE, NULL);
if (locale != NULL) {
char const *lang_sep = strchr (locale, '.');
if (lang_sep)
- lang = g_strndup (locale, (unsigned)(lang_sep - locale));
+ lang = g_strndup (locale, lang_sep - locale);
else
- lang = g_strdup (locale); /* simplifies exit */
+ lang = g_strdup (locale);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]