From d14f65a331a980e1bc4666b8c52b7b61ccd38f58 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 15 Feb 2009 04:27:39 +0200 Subject: [PATCH] bug 1067: Comments about freeing the DOM document node. --- src/document/dom/renderer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/document/dom/renderer.c b/src/document/dom/renderer.c index 35ac48108..38cd08304 100644 --- a/src/document/dom/renderer.c +++ b/src/document/dom/renderer.c @@ -720,6 +720,10 @@ render_dom_document_end(struct dom_stack *stack, struct dom_node *node, void *da render_dom_flush(renderer, renderer->end); } + /* It is not necessary to return DOM_CODE_FREE_NODE here. + * Because the parser was created with the SGML_PARSER_STREAM + * type, the stack has the DOM_STACK_FLAG_FREE_NODES flag and + * implicitly frees all nodes popped from it. */ return DOM_CODE_OK; } @@ -947,6 +951,10 @@ dom_rss_pop_document(struct dom_stack *stack, struct dom_node *root, void *data) done_dom_string(&renderer->text); mem_free_if(renderer->items); + /* ELinks does not provide any sort of DOM access to the RSS + * document after it has been rendered. Tell the caller to + * free the document node and all of its children. Otherwise, + * they would leak. */ return DOM_CODE_FREE_NODE; }