Fix memory leaks in tests

This commit is contained in:
Max Brunsfeld 2014-06-09 21:16:33 -07:00
parent 21c259df9c
commit 1b1f53a5e7
2 changed files with 11 additions and 4 deletions

View file

@ -24,11 +24,13 @@ describe("Languages", [&]() {
before_each([&]() {
ts_document_set_parser(doc, parser_constructor());
});
for (auto &entry : test_entries_for_language(language)) {
it(entry.description.c_str(), [&]() {
ts_document_set_input_string(doc, entry.input.c_str());
AssertThat(ts_document_string(doc), Equals(entry.tree_string.c_str()));
auto doc_string = ts_document_string(doc);
AssertThat(doc_string, Equals(entry.tree_string.c_str()));
free((void *)doc_string);
});
}
});