[gnumeric] xls: plug a pile of leaks.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: plug a pile of leaks.
- Date: Mon, 5 Oct 2009 20:09:59 +0000 (UTC)
commit 3225f1b01718623d120fddf86c2a5f2982061c5c
Author: Morten Welinder <terra gnome org>
Date: Mon Oct 5 16:09:20 2009 -0400
xls: plug a pile of leaks.
ChangeLog | 6 ------
NEWS | 1 +
plugins/excel/ChangeLog | 10 ++++++++++
plugins/excel/ms-chart.c | 12 ++++++++----
plugins/excel/ms-excel-write.c | 32 +++++++++++++++++++++++++-------
5 files changed, 44 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ea55d77..b007552 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,3 @@
-2009-10-05 Morten Welinder <terra gnome org>
-
- * plugins/excel/ms-excel-write.c (excel_write_textbox_v8): Export
- object name.
- (excel_sheet_new): Prepare for handling lines.
-
2009-10-04 Morten Welinder <terra gnome org>
* src/gnm-so-filled.c (gnm_so_filled_init): Make is-oval readable.
diff --git a/NEWS b/NEWS
index 5909723..5308856 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ Morten:
* Fix Excel-crashing export problem with objects. [#596886]
* Add name property to sheet objects.
* Start cleaning up xls sheet object writing.
+ * Plug xls export leaks.
--------------------------------------------------------------------------
Gnumeric 1.9.13
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index bd4cd7c..9d4c810 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,15 @@
2009-10-05 Morten Welinder <terra gnome org>
+ * plugins/excel/ms-excel-write.c (excel_write_textbox_v8): Export
+ object name.
+ (excel_sheet_new): Prepare for handling lines.
+ (blipinf_new): Plug leak.
+ (extract_txomarkup): Plug leak.
+ (xf_init, cb_cell_pre_pass, cb_accum_styles,
+ excel_write_ClientTextbox): Plug leak.
+
+ * ms-chart.c (map_1_5d_type): Plug leak.
+
* ms-biff.h (_BiffPut): Change type of streamPos to gsf_off_t.
* ms-chart.c (chart_write_axis): Don't dump uninitialized memory
diff --git a/plugins/excel/ms-chart.c b/plugins/excel/ms-chart.c
index 0f50832..7ac0021 100644
--- a/plugins/excel/ms-chart.c
+++ b/plugins/excel/ms-chart.c
@@ -4959,17 +4959,21 @@ static guint16
map_1_5d_type (XLChartWriteState *s, GogPlot const *plot,
guint16 stacked, guint16 percentage, guint16 flag_3d)
{
- char const *type;
+ char *type;
gboolean in_3d = FALSE;
guint16 res;
g_object_get (G_OBJECT (plot), "type", &type, "in-3d", &in_3d, NULL);
res = (s->bp->version >= MS_BIFF_V8 && in_3d) ? flag_3d : 0;
+
if (0 == strcmp (type, "stacked"))
- return res | stacked;
- if (0 == strcmp (type, "as_percentage"))
- return res | percentage | stacked;
+ res |= stacked;
+ else if (0 == strcmp (type, "as_percentage"))
+ res |= (percentage | stacked);
+
+ g_free (type);
+
return res;
}
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 88fcf9d..2fcf898 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -92,7 +92,7 @@
#define N_CELLS_BETWEEN_UPDATES 100
typedef struct {
- char const *type;
+ char *type;
GByteArray bytes;
gint32 uncomp_len;
gint32 header_len;
@@ -1828,7 +1828,7 @@ gather_palette (XLExportBase *xle)
/* For each color in each style, get color index from hash. If
none, it is not there yet, and we enter it. */
- g_hash_table_foreach (xle->xf.two_way_table->unique_keys,
+ g_hash_table_foreach (twt->unique_keys,
(GHFunc) put_colors, xle);
twt = xle->pal.two_way_table;
@@ -2339,6 +2339,17 @@ excel_write_FORMATs (ExcelWriteState *ewb)
excel_write_FORMAT (ewb, i);
}
+static void
+after_put_esv (ExcelStyleVariant *esv, gboolean was_added, gint index,
+ gpointer user)
+{
+ if (was_added) {
+ ;
+ } else {
+ g_free (esv);
+ }
+}
+
/**
* Initialize XF/GnmStyle table.
*
@@ -2375,7 +2386,8 @@ xf_init (XLExportBase *xle)
esv = g_new (ExcelStyleVariant, 1);
esv->style = xle->xf.default_style;
esv->variant = 0;
- two_way_table_put (xle->xf.two_way_table, esv, TRUE, NULL, NULL);
+ two_way_table_put (xle->xf.two_way_table, esv, TRUE,
+ (AfterPutFunc)after_put_esv, NULL);
put_style_font (esv, NULL, xle);
put_format (esv, NULL, xle);
@@ -2515,7 +2527,8 @@ cb_cell_pre_pass (gpointer ignored, GnmCell const *cell, ExcelWriteState *ewb)
esv->variant = 1;
esv->style = style;
xf = two_way_table_put (ewb->base.xf.two_way_table,
- esv, FALSE, NULL, NULL);
+ esv, FALSE,
+ (AfterPutFunc)after_put_esv, NULL);
g_hash_table_insert (ewb->base.xf.cell_style_variant,
(gpointer)cell,
GINT_TO_POINTER (1));
@@ -2529,7 +2542,8 @@ cb_accum_styles (GnmStyle const *st, gconstpointer dummy, XLExportBase *xle)
ExcelStyleVariant *esv = g_new (ExcelStyleVariant, 1);
esv->style = st;
esv->variant = 0;
- two_way_table_put (xle->xf.two_way_table, esv, TRUE, NULL, NULL);
+ two_way_table_put (xle->xf.two_way_table, esv, TRUE,
+ (AfterPutFunc)after_put_esv, NULL);
}
static void
@@ -4090,7 +4104,8 @@ blipinf_new (SheetObjectImage *soi)
}
if (buffer) {
- blip->type = "png";
+ g_free (blip->type);
+ blip->type = g_strdup ("png");
blip->bytes.data = buffer;
blip->needs_free = TRUE;
blip->header_len = BSE_HDR_LEN + RASTER_BLIP_HDR_LEN;
@@ -4110,7 +4125,7 @@ static void
blipinf_free (BlipInf *blip)
{
if (blip) { /* It is not a bug if blip == NULL */
- blip->type = NULL;
+ g_free (blip->type);
if (blip->needs_free) {
g_free (blip->bytes.data);
blip->needs_free = FALSE;
@@ -4227,6 +4242,8 @@ excel_write_ClientTextbox (ExcelWriteState *ewb, SheetObject *so)
ms_biff_put_var_write (bp, buf, 8);
ms_biff_put_commit (bp);
+ g_free (label);
+
return draw_len;
}
@@ -5956,6 +5973,7 @@ extract_txomarkup (ExcelWriteState *ewb, SheetObject *so)
/* It isn't a cell, but that doesn't matter here */
g_hash_table_insert (ewb->cell_markup, (gpointer)so, txo);
+ pango_attr_list_unref (markup);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]