[gnumeric] Plug leak in ODF import and export. [#747590]



commit 2c8d68548e5c5e80bab4d1968a3b55bd176a959d
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Thu Apr 9 20:22:42 2015 -0600

    Plug leak in ODF import and export. [#747590]
    
    2015-04-09  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-write.c (odf_write_sheet_control_button): fix leak
        (odf_write_axis_full): fix leak

 NEWS                                  |    2 +-
 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-write.c |   14 +++++++++-----
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index 70a6f2d..1606555 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Andreas:
        * Simplify export of SEC and SECH to ODF. [#747211]
        * Harden ODF import against fuzzed files. [#747447][#747448]
        * Fix ODF import/export of unlinked checkboxes and radio buttons.
-       * Plug leak in ODF import.
+       * Plug leak in ODF import and export. [#747590]
 
 Jean:
        * Fix signal handling while running Python. [#744638]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 33e0536..7ee5122 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2015-04-09  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-write.c (odf_write_sheet_control_button): fix leak
+       (odf_write_axis_full): fix leak
+
+2015-04-09  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-read.c (odf_validation_new_pair_expr): fix leak
 
 2015-04-08  Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 5069362..bf70df9 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -4202,10 +4202,12 @@ odf_write_sheet_control_button (GnmOOExport *state, SheetObject *so)
        GnmExprTop const *texpr = sheet_widget_button_get_link (so);
        char *label = NULL;
 
-       g_object_get (G_OBJECT (so), "text", &label, NULL);
-
        odf_sheet_control_start_element (state, so, FORM "button");
+
+       g_object_get (G_OBJECT (so), "text", &label, NULL);
        gsf_xml_out_add_cstr (state->xml, FORM "label", label);
+       g_free (label);
+
        gsf_xml_out_add_cstr_unchecked (state->xml, FORM "button-type", "push");
 
        if (texpr != NULL ) {
@@ -7809,7 +7811,7 @@ odf_write_axis_full (GnmOOExport *state,
                     gboolean include_cats)
 {
        GSList *children = NULL, *l;
-       GString *str = g_string_new (NULL);
+       GString *str;
 
        if (axis_role == NULL)
                return;
@@ -7821,6 +7823,7 @@ odf_write_axis_full (GnmOOExport *state,
                GogObject const *axis = l->data;
                if (axis != NULL) {
                        int id = gog_object_get_id (GOG_OBJECT (axis));
+                       char *name;
 
                        gsf_xml_out_start_element (state->xml, CHART "axis");
                        gsf_xml_out_add_cstr (state->xml, CHART "dimension", dimension);
@@ -7829,8 +7832,9 @@ odf_write_axis_full (GnmOOExport *state,
                        g_string_truncate (str, 0);
                        g_string_append_printf (str, "%s-%i", axis_role, id);
                        gsf_xml_out_add_cstr_unchecked (state->xml, CHART "name", str->str);
-                       gsf_xml_out_add_cstr (state->xml, CHART "style-name",
-                                             odf_get_gog_style_name_from_obj (state, GOG_OBJECT (axis)));
+                       name = odf_get_gog_style_name_from_obj (state, GOG_OBJECT (axis));
+                       if (name != NULL)
+                               gsf_xml_out_add_cstr (state->xml, CHART "style-name", name);
                        odf_write_label (state, axis);
                        if (include_cats)
                                odf_write_axis_categories (state, series);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]