[gnumeric] xml: leak fix.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xml: leak fix.
- Date: Fri, 29 Jan 2016 16:17:00 +0000 (UTC)
commit 5d3781c3bdc141fec9cb24f9146dce176a5bff7c
Author: Morten Welinder <terra gnome org>
Date: Fri Jan 29 11:16:46 2016 -0500
xml: leak fix.
ChangeLog | 3 +++
src/xml-sax-read.c | 11 ++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0d21930..5c85c66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-01-29 Morten Welinder <terra gnome org>
+ * src/xml-sax-read.c (xml_sax_filter_condition): Leak fix and warn
+ about broken sheet filter.
+
* src/sheet-filter.c (gnm_filter_condition_new_single)
(gnm_filter_condition_new_double): Plug leak on error.
(gnm_filter_op_needs_value): Handle GNM_FILTER_UNUSED.
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index 4e4d1a8..749c35f 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -2332,15 +2332,20 @@ xml_sax_filter_condition (GsfXMLIn *xin, xmlChar const **attrs)
go_io_warning (state->context, _("Missing filter type"));
} else if (0 == g_ascii_strcasecmp (type, "expr")) {
GnmValue *v0 = NULL, *v1 = NULL;
- if (val0 != NULL && vtype0 != VALUE_EMPTY)
+ if (val0 && vtype0 != VALUE_EMPTY && op0 != GNM_FILTER_UNUSED)
v0 = value_new_from_string (vtype0, val0, NULL, FALSE);
- if (val1 != NULL && vtype1 != VALUE_EMPTY)
+ if (val1 && vtype1 != VALUE_EMPTY && op1 != GNM_FILTER_UNUSED)
v1 = value_new_from_string (vtype1, val1, NULL, FALSE);
if (v0 && v1)
cond = gnm_filter_condition_new_double (
op0, v0, is_and, op1, v1);
- else if (v0)
+ else if (v0 && op0)
cond = gnm_filter_condition_new_single (op0, v0);
+ else {
+ go_io_warning (state->context, _("Malformed sheet filter condition"));
+ value_release (v0);
+ value_release (v1);
+ }
} else if (0 == g_ascii_strcasecmp (type, "blanks")) {
cond = gnm_filter_condition_new_single (
GNM_FILTER_OP_BLANKS, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]