summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-30 22:10:09 (GMT)
committer Rupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-30 22:10:09 (GMT)
commit1eaa38650c5a828ff47cc145ac843bde3840ec1c (patch)
treef44bcaba5ee6ec38539ba18177accdd2a38f6640
parentfd73a1bac9d352c77c2e8412d076f16ae06a795d (diff)
downloadlibdom-1eaa38650c5a828ff47cc145ac843bde3840ec1c.tar.gz
libdom-1eaa38650c5a828ff47cc145ac843bde3840ec1c.tar.bz2
table section ref counting (will be rebased if buggy)
-rw-r--r--src/html/html_tablesection_element.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/html/html_tablesection_element.c b/src/html/html_tablesection_element.c
index af4ccb6..dbc0902 100644
--- a/src/html/html_tablesection_element.c
+++ b/src/html/html_tablesection_element.c
@@ -217,26 +217,42 @@ dom_exception dom_html_table_section_element_insert_row(
return exp;
exp = dom_html_table_section_element_get_rows(element, &rows);
- if(exp != DOM_NO_ERR)
+ if(exp != DOM_NO_ERR) {
+ dom_node_unref(new_row);
+ new_row = NULL;
return exp;
+ }
exp = dom_html_collection_get_length(rows, &len);
- if(exp != DOM_NO_ERR)
+
+
+ if(exp != DOM_NO_ERR) {
+ dom_node_unref(new_row);
+ new_row = NULL;
+ dom_html_collection_unref(rows);
return exp;
+ }
if(index < -1 || index > (int32_t)len) {
/* Check for index validity */
+ dom_html_collection_unref(rows);
return DOM_INDEX_SIZE_ERR;
} else if(index == -1 || index == (int32_t)len) {
- return _dom_node_append_child((dom_node_internal *)element,
- (dom_node_internal *)*new_row,
- (dom_node_internal **)new_row);
+ dom_node *new_node;
+ dom_html_collection_unref(rows);
+ return dom_node_append_child(element,
+ *new_row,
+ &new_node);
} else {
+ dom_node *new_node;
+
dom_html_collection_item(rows,
index, &node);
- return _dom_node_insert_before((dom_node_internal *)element,
- (dom_node_internal *)*new_row, (dom_node_internal *)node,
- (dom_node_internal **)new_row);
+ dom_html_collection_unref(rows);
+
+ return dom_node_insert_before(element,
+ *new_row, node,
+ &new_node);
}
}