https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7447

            Bug ID: 7447
           Summary: [PATCH] Memory leak in Mail::Spamassassin::Message
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Libraries
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: Undefined

I've found a memory leak in the Mail::Spamassassin::Message module. The Message
object initializes the parse_queue array with one element which contains a
reference back to the Message object. parse_queue is deleted when parse_body()
is called. However, if parse_body() is never called before the Message object
is destroyed, the array will remain with the circular reference inside it and
the whole object will leak.

This usually isn't serious because parse_body() or something that calls it is
usually called before the message is destroyed. But this isn't guaranteed. In
particular, one code path in sa-learn (when the message to be learned contains
SpamAssassin headers) will trigger this leak, and with many messages (~30k)
this can easily cause sa-learn to consume gigabytes of memory.

The attached patch addresses this by deleting parse_queue in the finish()
routine.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to