[libgsf] Fix allocation method problem. [#579155]
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [libgsf] Fix allocation method problem. [#579155]
- Date: Fri, 17 Apr 2009 10:56:51 -0400 (EDT)
commit 6607845257c13cfcc08e3a0767315ca361d02e25
Author: Morten Welinder <terra gnome org>
Date: Fri Apr 17 10:54:23 2009 -0400
Fix allocation method problem. [#579155]
Christian Persch:
gsf-output.c is allocating output->err using g_new, but also using
g_clear_error() on it. This will crash, since glib uses GSlice for GErrors.
---
ChangeLog | 5 +++++
NEWS | 3 +++
gsf/gsf-output.c | 12 ++++++++----
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 35bdb1a..f85f5a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-17 Morten Welinder <terra gnome org>
+
+ * gsf/gsf-output.c (gsf_output_set_error): Fix allocation method
+ problem for errors. Fixes #579155.
+
2009-04-15 Morten Welinder <terra gnome org>
* gsf/gsf-infile-msole.c (gsf_infile_msole_new_child): Fix a
diff --git a/NEWS b/NEWS
index 3d75aa3..294c6ea 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ libgsf 1.14.12
Andreas:
* also read user defined OpenDocument metadata
+Christian Persch:
+ * Fix allocation method problem. [#579155]
+
J.H.M. Dassen (Ray):
* Fix incorrect use of g_enum_register_static which broke
documentation generation in some environments.
diff --git a/gsf/gsf-output.c b/gsf/gsf-output.c
index 4a01acd..1550d1a 100644
--- a/gsf/gsf-output.c
+++ b/gsf/gsf-output.c
@@ -462,13 +462,17 @@ gsf_output_set_error (GsfOutput *output,
g_clear_error (&output->err);
if (format != NULL) {
+ char *message;
va_list args;
+
va_start (args, format);
- output->err = g_new (GError, 1);
- output->err->domain = gsf_output_error_id ();
- output->err->code = code;
- output->err->message = g_strdup_vprintf (format, args);
+ message = g_strdup_vprintf (format, args);
va_end (args);
+
+ output->err = g_error_new_literal (gsf_output_error_id (),
+ code,
+ message);
+ g_free (message);
}
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]