]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1336958 - Call delete on HTML::Tree objects to avoid leaking memory
authorDylan William Hardison <dylan@hardison.net>
Mon, 6 Feb 2017 15:46:36 +0000 (10:46 -0500)
committerDylan William Hardison <dylan@hardison.net>
Mon, 6 Feb 2017 15:46:36 +0000 (10:46 -0500)
extensions/Profanivore/Extension.pm
extensions/SecureMail/Extension.pm

index 76d30e982a4888341bf81c53e8b8aef56c1e963e..9584ee695a53f55064a63c9cbefa2255112bcac7 100644 (file)
@@ -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 {
index e62938dc764c8b79b44d0fc2ebfb9e24431988a4..d3dc023f6b64494d9e255b73d25e387365b24522 100644 (file)
@@ -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;
     });
 }