summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-02-06 16:46:36 +0100
committerDylan William Hardison <dylan@hardison.net>2017-02-06 16:46:36 +0100
commit92ca9f67a4a2306218491ac45607a33414b96ad9 (patch)
tree0714b0c90f6256546bda0b8693e051571e5e8bc0
parentdc479382176a0638fb978149e91c258ec9af6c28 (diff)
downloadbugzilla-92ca9f67a4a2306218491ac45607a33414b96ad9.tar.gz
bugzilla-92ca9f67a4a2306218491ac45607a33414b96ad9.tar.xz
Bug 1336958 - Call delete on HTML::Tree objects to avoid leaking memory
-rw-r--r--extensions/Profanivore/Extension.pm6
-rw-r--r--extensions/SecureMail/Extension.pm2
2 files changed, 7 insertions, 1 deletions
diff --git a/extensions/Profanivore/Extension.pm b/extensions/Profanivore/Extension.pm
index 76d30e982..9584ee695 100644
--- a/extensions/Profanivore/Extension.pm
+++ b/extensions/Profanivore/Extension.pm
@@ -161,7 +161,11 @@ sub _filter_html {
foreach my $comment (@comments) {
_filter_html_node($comment, \$dirty);
}
- return $dirty ? $tree->as_HTML : $html;
+ if ($dirty) {
+ $html = $tree->as_HTML;
+ $tree->delete;
+ }
+ return $html;
}
sub _filter_html_node {
diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm
index e62938dc7..d3dc023f6 100644
--- a/extensions/SecureMail/Extension.pm
+++ b/extensions/SecureMail/Extension.pm
@@ -646,6 +646,7 @@ sub _insert_subject {
my $body = $tree->look_down(qw(_tag body));
$body->unshift_content(['h1', "Subject: $subject"], ['br']);
$part->body_str_set($tree->as_HTML);
+ $tree->delete;
}
}
@@ -696,6 +697,7 @@ sub _filter_bug_links {
if ($updated) {
$part->body_str_set($tree->as_HTML);
}
+ $tree->delete;
});
}