[gnumeric] xls: plug leaks.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: plug leaks.
- Date: Thu, 30 Oct 2014 23:31:28 +0000 (UTC)
commit 37dd60befcc638c8085da571bb86d23c615a0100
Author: Morten Welinder <terra gnome org>
Date: Thu Oct 30 19:30:44 2014 -0400
xls: plug leaks.
plugins/excel/ChangeLog | 8 ++++++++
plugins/excel/ms-excel-read.c | 23 +++++++++++++++++------
plugins/excel/ms-obj.c | 3 +++
3 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 1f9ec8d..3a05728 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,11 @@
+2014-10-30 Morten Welinder <terra gnome org>
+
+ * ms-excel-read.c (excel_font_get): In case of error, fall back to
+ font 0 if we have that.
+ (ms_wb_get_font_markup): Plug leak.
+
+ * ms-obj.c (ms_obj_map_forms_obj): Plug leak.
+
2014-10-28 Morten Welinder <terra gnome org>
* ms-chart.c (ms_excel_chart_read): Fix double free.
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index eccc305..6425f2a 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -196,6 +196,8 @@ char const *excel_builtin_formats[EXCEL_BUILTIN_FORMAT_LEN] = {
/* 0x31 */ "@"
};
+static PangoAttrList *empty_attr_list;
+
static MsBiffVersion
esheet_ver (ExcelReadSheet const *esheet)
{
@@ -1968,11 +1970,15 @@ excel_read_PALETTE (BiffQuery *q, GnmXLImporter *importer)
ExcelFont const *
excel_font_get (GnmXLImporter const *importer, unsigned font_idx)
{
- ExcelFont const *fd = g_hash_table_lookup (
- importer->font_data, GINT_TO_POINTER (font_idx));
-
- g_return_val_if_fail (fd != NULL, NULL); /* flag the problem */
- g_return_val_if_fail (fd->index != 4, NULL); /* should not exist */
+ ExcelFont const *fd =
+ g_hash_table_lookup (importer->font_data,
+ GINT_TO_POINTER (font_idx));
+ if (!fd) {
+ g_warning ("Invalid font index %d\n", font_idx);
+ /* Try fallback. */
+ fd = g_hash_table_lookup (importer->font_data,
+ GINT_TO_POINTER (0));
+ }
return fd;
}
@@ -3249,7 +3255,7 @@ ms_wb_get_font_markup (MSContainer const *c, unsigned indx)
ExcelFont const *fd = excel_font_get (importer, indx);
if (fd == NULL || indx == 0)
- return pango_attr_list_new ();
+ return empty_attr_list;
if (fd->attrs == NULL) {
ExcelFont const *fd0 = excel_font_get (importer, 0);
@@ -7400,6 +7406,8 @@ excel_read_init (void)
(gpointer)gnm_name,
(gpointer)efd);
}
+
+ empty_attr_list = pango_attr_list_new ();
}
void
@@ -7410,4 +7418,7 @@ excel_read_cleanup (void)
g_slist_free_full (formats, (GDestroyNotify)go_format_unref);
formats = NULL;
+
+ pango_attr_list_unref (empty_attr_list);
+ empty_attr_list = NULL;
}
diff --git a/plugins/excel/ms-obj.c b/plugins/excel/ms-obj.c
index c0c447b..09944d8 100644
--- a/plugins/excel/ms-obj.c
+++ b/plugins/excel/ms-obj.c
@@ -938,6 +938,9 @@ ms_obj_map_forms_obj (MSObj *obj, MSContainer *c,
if (map_forms [i].excel_type > 0 &&
!strcmp (type+6, map_forms[i].key))
break;
+
+ g_free (type);
+
if (i < 0)
return;
obj->excel_type = map_forms [i].excel_type;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]