- Commit
- 7dfe7fff11d7c22404db9f72c77bdb930267c634
- Parent
- 74c42c9eee645a4f65b19e74187876188f3e6a8a
- Author
- Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
- Date
api_test: fix leak
Replaced nodes are not automatically freed.
My personal build of CMark ✏️
api_test: fix leak
Replaced nodes are not automatically freed.
1 file changed, 3 insertions, 0 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | api_test/main.c | 3 | 3 | 0 |
diff --git a/api_test/main.c b/api_test/main.c @@ -362,6 +362,9 @@ static void create_tree(test_batch_runner *runner) { cmark_node *str4 = cmark_node_new(CMARK_NODE_TEXT); cmark_node_set_literal(str4, "brzz"); OK(runner, cmark_node_replace(str1, str4), "replace"); + // The replaced node is not freed + cmark_node_free(str1); + INT_EQ(runner, cmark_node_check(doc, NULL), 0, "replace consistent"); OK(runner, cmark_node_previous(emph) == str4, "replace works"); INT_EQ(runner, cmark_node_replace(p, str4), 0, "replace str for p fails");