[gnumeric] number-match: fix problem with time_formats.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] number-match: fix problem with time_formats.
- Date: Tue, 13 Sep 2011 20:00:16 +0000 (UTC)
commit 9eb2b5ea7d797271386d89c7d82763ab24890ace
Author: Morten Welinder <terra gnome org>
Date: Tue Sep 13 15:59:44 2011 -0400
number-match: fix problem with time_formats.
ChangeLog | 5 +++++
NEWS | 1 +
src/number-match.c | 5 +++--
3 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 50ff8ea..3cde5a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-13 Morten Welinder <terra gnome org>
+
+ * src/number-match.c (format_match_datetime): Make sure
+ time_format doesn't get freed underneath us. See #658982.
+
2011-09-13 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/stf.c (stf_open_and_read): do not check for NUL here
diff --git a/NEWS b/NEWS
index a8fedc9..9b8b2bd 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ Jean:
Morten:
* Fix crash. [#658140]
+ * Fix stf import crash. [#658982]
Valek:
* In xls import, set LABEL encoding based on FONT charset converted to
diff --git a/src/number-match.c b/src/number-match.c
index 48dbf38..f3f09b3 100644
--- a/src/number-match.c
+++ b/src/number-match.c
@@ -654,7 +654,7 @@ format_match_datetime (char const *text,
int dig1;
char *date_format = NULL;
GnmValue *res = NULL;
- const char *time_format = NULL;
+ char *time_format = NULL;
if (lc_time != datetime_locale.lc_time &&
(lc_time == NULL ||
@@ -818,7 +818,7 @@ format_match_datetime (char const *text,
time_val = value_get_as_float (v);
fmt = VALUE_FMT (v);
if (fmt)
- time_format = go_format_as_XL (fmt);
+ time_format = g_strdup (go_format_as_XL (fmt));
value_release (v);
} else
time_val = 0;
@@ -841,6 +841,7 @@ format_match_datetime (char const *text,
out:
g_free (date_format);
+ g_free (time_format);
return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]