pidgin/pidgin

Correctly free parse tags at end of purple_html_to_xhtml.
release-2.x.y
2021-09-13, Elliott Sales de Andrade
c8e2ffe9b4d0
Parents 59a77978ca08
Children 581ae0eecd0d
Correctly free parse tags at end of purple_html_to_xhtml.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34996

Testing Done:
Ran the test case from the bug against `fuzz_html_to_xhtml`

Reviewed at https://reviews.imfreedom.org/r/913/
--- a/libpurple/util.c Mon Sep 13 17:06:37 2021 -0500
+++ b/libpurple/util.c Mon Sep 13 17:07:15 2021 -0500
@@ -1865,12 +1865,12 @@
c++;
}
}
- if(xhtml) {
- for (tag = tags; tag ; tag = tag->next) {
- struct purple_parse_tag *pt = tag->data;
- if(!pt->ignore)
- g_string_append_printf(xhtml, "</%s>", pt->dest_tag);
+ for (tag = tags; tag ; tag = tag->next) {
+ struct purple_parse_tag *pt = tag->data;
+ if (xhtml && !pt->ignore) {
+ g_string_append_printf(xhtml, "</%s>", pt->dest_tag);
}
+ g_free(pt);
}
g_list_free(tags);
if(xhtml_out)