[gnumeric] xlsx, xls: plug leak.



commit 16a6f333166992acf0b5f20703cb0acbb3e0dfcb
Author: Morten Welinder <terra gnome org>
Date:   Tue Feb 17 12:58:03 2015 -0500

    xlsx, xls: plug leak.

 plugins/excel/ChangeLog        |    2 ++
 plugins/excel/ms-excel-write.c |   14 ++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 64564ef..a86ab17 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,7 @@
 2015-02-17  Morten Welinder  <terra gnome org>
 
+       * ms-excel-write.c (excel_collect_validations): Plug leak.
+
        * xlsx-write-drawing.c (xlsx_go_style_has_font): Simplify now that
        we have a sane auto_font.
 
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 18ecd3d..ecd3963 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -6806,6 +6806,13 @@ vip_equal (XLValInputPair const *a, XLValInputPair const *b)
        return a->v == b->v && a->msg == b->msg;
 }
 
+static void
+vip_free (XLValInputPair *vip)
+{
+       g_slist_free (vip->ranges);
+       g_free (vip);
+}
+
 /* We store input msg and validation as distinct items, XL merges them find the
  * pairs, and the regions that use them */
 GHashTable *
@@ -6813,8 +6820,11 @@ excel_collect_validations (GnmStyleList *ptr, int max_col, int max_row)
 {
        GnmStyleRegion const *sr;
        XLValInputPair key, *tmp;
-       GHashTable *group = g_hash_table_new_full ((GHashFunc)&vip_hash,
-               (GCompareFunc)&vip_equal, g_free, NULL);
+       GHashTable *group = g_hash_table_new_full
+               ((GHashFunc)vip_hash,
+                (GCompareFunc)vip_equal,
+                (GDestroyNotify)vip_free,
+                NULL);
 
        for (; ptr != NULL ; ptr = ptr->next) {
                sr = ptr->data;


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