[gnumeric] xls, xlsx: plug leaks.



commit 23dbb6f4beeb72d41fd0f65d4e375c1c3fc34466
Author: Morten Welinder <terra gnome org>
Date:   Tue Jun 16 08:51:24 2015 -0400

    xls, xlsx: plug leaks.

 plugins/excel/ChangeLog        |    3 +++
 plugins/excel/ms-excel-write.c |    7 +++++--
 plugins/excel/xlsx-read.c      |    3 +++
 3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index da84760..f2943c6 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,7 +1,10 @@
 2015-06-16  Morten Welinder  <terra gnome org>
 
+       * xlsx-read.c (xlsx_file_open): Plug leaks.
+
        * ms-excel-write.c (excel_convert_string): Ensure multi-NUL
        terminator.  Fixes #750856.
+       (excel_convert_string): Plug leak.
 
 2015-06-15  Morten Welinder  <terra gnome org>
 
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 64c81be..ac2c70e 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -291,6 +291,7 @@ excel_convert_string (BiffPut *bp, const char *txt, size_t *out_bytes)
        size_t bytes_read;
        GString *accum;
        gpointer res;
+       gboolean is_ilseq;
 
        res = g_convert_with_iconv
                (txt, -1,
@@ -300,8 +301,10 @@ excel_convert_string (BiffPut *bp, const char *txt, size_t *out_bytes)
        if (res)
                return res;
 
-       if (!g_error_matches (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE)) {
-               g_error_free (err);
+       is_ilseq = g_error_matches (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE);
+       g_error_free (err);
+
+       if (!is_ilseq) {
                g_printerr ("Unexpected conversion error for string\n");
                *out_bytes = 0;
                return g_strdup ("");
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 61899db..2ecd658 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -5186,6 +5186,9 @@ xlsx_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *context,
                }
                g_array_free (state.sst, TRUE);
        }
+       if (state.r_text) g_string_free (state.r_text, TRUE);
+       if (state.rich_attrs) pango_attr_list_unref (state.rich_attrs);
+       if (state.run_attrs) pango_attr_list_unref (state.run_attrs);
        g_hash_table_destroy (state.pivot.cache_by_id);
        xlsx_conventions_free (state.convs);
        go_format_unref (state.date_fmt);


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