1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[dom] Bad function for unref caused memory leak.

This commit is contained in:
Witold Filipczyk 2023-05-28 16:50:19 +02:00
parent df7c4c0579
commit 41074ac1ca
2 changed files with 6 additions and 4 deletions

View File

@ -106,7 +106,7 @@ dump_dom_element(void *mapa, struct string *buf, dom_node *node, int depth)
dom_exception exc;
dom_string *node_name = NULL;
dom_node_type type;
dom_namednodemap *attrs;
dom_namednodemap *attrs = NULL;
/* Only interested in element nodes */
exc = dom_node_get_node_type(node, &type);
@ -169,7 +169,7 @@ dump_dom_element(void *mapa, struct string *buf, dom_node *node, int depth)
}
}
}
dom_node_unref(attrs);
dom_namednodemap_unref(attrs);
}
add_char_to_string(buf, '>');

View File

@ -108,7 +108,7 @@ dump_dom_element(void *mapa, struct string *buf, dom_node *node, int depth)
dom_exception exc;
dom_string *node_name = NULL;
dom_node_type type;
dom_namednodemap *attrs;
dom_namednodemap *attrs = NULL;
/* Only interested in element nodes */
exc = dom_node_get_node_type(node, &type);
@ -171,7 +171,9 @@ dump_dom_element(void *mapa, struct string *buf, dom_node *node, int depth)
}
}
}
dom_node_unref(attrs);
}
if (attrs) {
dom_namednodemap_unref(attrs);
}
add_char_to_string(buf, '>');