$OpenBSD: patch-lib_Mail_SpamAssassin_Message_pm,v 1.2 2017/10/31 07:41:51 giovanni Exp $

# bug 7447: Delete parse_queue in Message::finish() to prevent memory leak.

Index: lib/Mail/SpamAssassin/Message.pm
--- lib/Mail/SpamAssassin/Message.pm.orig
+++ lib/Mail/SpamAssassin/Message.pm
@@ -628,6 +628,9 @@ sub finish {
   delete $self->{'line_ending'};
   delete $self->{'missing_head_body_separator'};
 
+  # Remove the queue variable, in case the body has not been parsed
+  delete $self->{'parse_queue'};
+
   my @toclean = ( $self );
 
   # Go ahead and clean up all of the Message::Node parts
@@ -1045,6 +1048,9 @@ sub _parse_normal {
   }
   elsif ($ct[3]) {
     $msg->{'name'} = $ct[3];
+  }
+  if ($msg->{'name'}) {
+    $msg->{'name'} = Encode::decode("MIME-Header", $msg->{'name'});
   }
 
   $msg->{'boundary'} = $boundary;
