diff --git a/render/box_construct.c b/render/box_construct.c index caa170477..e34e8d746 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1578,6 +1578,21 @@ bool box_frameset(BOX_SPECIAL_PARAMS) return ok; } + +/** + * Destructor for content_html_frames, for elements + * + * \param b The frame params being destroyed. + * \return 0 to allow talloc to continue destroying the tree. + */ +static int box_frames_talloc_destructor(struct content_html_frames *f) +{ + if (f->url != NULL) + nsurl_unref(f->url); + + return 0; +} + bool box_create_frameset(struct content_html_frames *f, xmlNode *n, html_content *content) { unsigned int row, col, index, i; @@ -1646,6 +1661,9 @@ bool box_create_frameset(struct content_html_frames *f, xmlNode *n, f->scrolling = SCROLLING_NO; f->children = talloc_array(content, struct content_html_frames, (rows * cols)); + + talloc_set_destructor(f->children, box_frames_talloc_destructor); + for (row = 0; row < rows; row++) { for (col = 0; col < cols; col++) { index = (row * cols) + col; @@ -1705,9 +1723,9 @@ bool box_create_frameset(struct content_html_frames *f, xmlNode *n, if (url) { /* no self-references */ if (nsurl_compare(content->base_url, url, - NSURL_COMPLETE)) + NSURL_COMPLETE) == false) frame->url = url; - url = NULL; + url = NULL; } /* fill in specified values */ @@ -1763,6 +1781,21 @@ bool box_create_frameset(struct content_html_frames *f, xmlNode *n, } +/** + * Destructor for content_html_iframe, for