[gnumeric] xml: plug leak.



commit b518ab58ba029aaaae7e1c91eed5849227e4d484
Author: Morten Welinder <terra gnome org>
Date:   Mon Aug 23 14:56:02 2010 -0400

    xml: plug leak.

 ChangeLog          |   10 +++++++---
 NEWS               |    1 +
 src/xml-sax-read.c |   38 +++++++++++++++++---------------------
 3 files changed, 25 insertions(+), 24 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d56bfde..6b9768f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-23  Morten Welinder  <terra gnome org>
+
+	* src/xml-sax-read.c (xml_sax_colrow): Simplify and plug leak.
+
 2010-08-20  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* samples/chart-tests.gnumeric: update tab colours
@@ -31,14 +35,14 @@
 
 	* samples/chart-tests.gnumeric: make sure the images match the graphs
 	  (and fix the data to make it more likely to stay in this way.)
-	
+
 2010-08-14  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/commands.c (CmdPasteCopy): new fields
 	(cmd_paste_copy_impl): store sizes for rows and columns and restore them
 	(cmd_paste_copy_finalize): finalize new fields
 	(cmd_paste_copy): iitalize new fields
-	
+
 2010-08-13  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/commands.c (cmd_area_set_array_expr): autofit rows and columns.
@@ -57,7 +61,7 @@
 
 2010-08-13  Andreas J. Guelzow <aguelzow pyrshep ca>
 
-	* src/commands.c (cmd_set_text_full): check whether the same-text and 
+	* src/commands.c (cmd_set_text_full): check whether the same-text and
 	  not same-markup situation in fact applies.
 
 2010-08-13  Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/NEWS b/NEWS
index 58a7ec8..70707eb 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Jean:
 
 Morten:
 	* Plug sylk importer leak.
+	* Plug xml importer leak.
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.9
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index aaafea1..778186d 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -1292,33 +1292,29 @@ xml_sax_colrow (GsfXMLIn *xin, xmlChar const **attrs)
 	maybe_update_progress (xin);
 
 	for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
-		if (gnm_xml_attr_int (attrs, "No", &pos)) {
-			g_return_if_fail (cri == NULL);
-
-			cri = is_col
-				? sheet_col_fetch (state->sheet, pos)
-				: sheet_row_fetch (state->sheet, pos);
-		} else {
-			if (gnm_xml_attr_double (attrs, "Unit", &size)) ;
-			else if (gnm_xml_attr_int (attrs, "Count", &count)) ;
-			else if (gnm_xml_attr_int (attrs, "HardSize", &hard_size)) ;
-			else if (gnm_xml_attr_int (attrs, "Hidden", &hidden)) ;
-			else if (gnm_xml_attr_int (attrs, "Collapsed", &is_collapsed)) ;
-			else if (gnm_xml_attr_int (attrs, "OutlineLevel", &outline_level)) ;
-			else if (gnm_xml_attr_int (attrs, "MarginA", &val))
-				; /* deprecated in 1.7.1 */
-			else if (gnm_xml_attr_int (attrs, "MarginB", &val))
-				; /* deprecated in 1.7.1 */
-			else
-				unknown_attr (xin, attrs);
-		}
+		if (gnm_xml_attr_int (attrs, "No", &pos)) ;
+		else if (gnm_xml_attr_double (attrs, "Unit", &size)) ;
+		else if (gnm_xml_attr_int (attrs, "Count", &count)) ;
+		else if (gnm_xml_attr_int (attrs, "HardSize", &hard_size)) ;
+		else if (gnm_xml_attr_int (attrs, "Hidden", &hidden)) ;
+		else if (gnm_xml_attr_int (attrs, "Collapsed", &is_collapsed)) ;
+		else if (gnm_xml_attr_int (attrs, "OutlineLevel", &outline_level)) ;
+		else if (gnm_xml_attr_int (attrs, "MarginA", &val))
+			; /* deprecated in 1.7.1 */
+		else if (gnm_xml_attr_int (attrs, "MarginB", &val))
+			; /* deprecated in 1.7.1 */
+		else
+			unknown_attr (xin, attrs);
 	}
 
+	XML_CHECK (size > -1);
 	XML_CHECK (pos >= 0 && pos < colrow_max (is_col, sheet));
 	XML_CHECK (count >= 1);
 	XML_CHECK (count <= colrow_max (is_col, sheet) - pos);
 
-	g_return_if_fail (cri != NULL && size > -1.);
+	cri = is_col
+		? sheet_col_fetch (state->sheet, pos)
+		: sheet_row_fetch (state->sheet, pos);
 	cri->hard_size = hard_size;
 	cri->visible = !hidden;
 	cri->is_collapsed = is_collapsed;



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