From f672c6c269351154eb6b294a5f4aeb955d13839a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 28 Jul 2018 17:32:16 +0100 Subject: Tests: Squash leak of hubbub parser. Found by address sanitizer. --- test/tree2.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/tree2.c b/test/tree2.c index dbebc99..6d8fb52 100644 --- a/test/tree2.c +++ b/test/tree2.c @@ -228,7 +228,10 @@ int main(int argc, char **argv) buf_clear(&got); buf_clear(&expected); - hubbub_parser_destroy(parser); + if (parser != NULL) { + hubbub_parser_destroy(parser); + parser = NULL; + } while (Document) { node_t *victim = Document; Document = victim->next; @@ -316,7 +319,10 @@ int main(int argc, char **argv) printf("%s", got.buf); } - hubbub_parser_destroy(parser); + if (parser != NULL) { + hubbub_parser_destroy(parser); + parser = NULL; + } while (Document) { node_t *victim = Document; Document = victim->next; @@ -331,6 +337,10 @@ int main(int argc, char **argv) free(got.buf); free(expected.buf); + if (parser != NULL) { + hubbub_parser_destroy(parser); + } + return 0; } -- cgit v1.2.3