diff --git a/src/document/dom/renderer.c b/src/document/dom/renderer.c index 30171b4f6..92c666422 100644 --- a/src/document/dom/renderer.c +++ b/src/document/dom/renderer.c @@ -1022,6 +1022,7 @@ render_dom_document(struct cache_entry *cached, struct document *document, { unsigned char *head = empty_string_or_(cached->head); struct dom_renderer renderer; + struct dom_config config; struct conv_table *convert_table; struct sgml_parser *parser; enum sgml_parser_type parser_type; @@ -1060,7 +1061,7 @@ render_dom_document(struct cache_entry *cached, struct document *document, } else if (renderer.doctype == SGML_DOCTYPE_RSS) { add_dom_stack_context(&parser->stack, &renderer, &dom_rss_renderer_context_info); - add_dom_config_normalizer(&parser->stack, RSS_CONFIG_FLAGS); + add_dom_config_normalizer(&parser->stack, &config, RSS_CONFIG_FLAGS); } /* FIXME: When rendering this way we don't really care about the code. diff --git a/src/dom/configuration.c b/src/dom/configuration.c index fa933610e..e722ebf76 100644 --- a/src/dom/configuration.c +++ b/src/dom/configuration.c @@ -224,7 +224,6 @@ dom_normalize_node_end(struct dom_stack *stack, struct dom_node *node, void *dat break; case DOM_NODE_DOCUMENT: - mem_free(config); break; default: @@ -285,20 +284,15 @@ static struct dom_stack_context_info dom_config_normalizer_context = { }; struct dom_config * -add_dom_config_normalizer(struct dom_stack *stack, enum dom_config_flag flags) +add_dom_config_normalizer(struct dom_stack *stack, struct dom_config *config, + enum dom_config_flag flags) { - struct dom_config *config; - - config = mem_calloc(1, sizeof(*config)); - if (!config) return NULL; - + memset(config, 0, sizeof(*config)); config->flags = flags; if (add_dom_stack_context(stack, config, &dom_config_normalizer_context)) return config; - mem_free(config); - return NULL; } diff --git a/src/dom/configuration.h b/src/dom/configuration.h index f86898bf3..2661cbf52 100644 --- a/src/dom/configuration.h +++ b/src/dom/configuration.h @@ -86,7 +86,8 @@ struct dom_config { }; struct dom_config * -add_dom_config_normalizer(struct dom_stack *stack, enum dom_config_flag flags); +add_dom_config_normalizer(struct dom_stack *stack, struct dom_config *config, + enum dom_config_flag flags); enum dom_config_flag parse_dom_config(unsigned char *flaglist, unsigned char separator);