< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] Potential memory leak in EncryptionManager::process


Here's the code I'm worried about:

in EncryptionManager::process(Message* msg)
*snip*
      if (contents)
      {
         if (setContents)
         {
            event->message()->setContents(auto_ptr<Contents>(contents));
            DumHelper::setEncryptionPerformed(*event->message());
         }
         return DumFeature::FeatureDone;
      }
      else
      {
         if (noCerts)
         {
            return DumFeature::ChainDoneAndEventDone;
         }
         else
         {
            //event->releaseMessage();
            return DumFeature::EventTaken;
         }
      }
*snip*

It is my understanding that a return of EventTaken denotes that the DumFeature has taken ownership of msg (event is msg cast to an OutgoingEvent*). However, in this case it has not taken ownership at all. At no point in the preceding code do we store the pointer, and we don't delete it before the return. Now, I am not even sure this code-path is reachable, but wouldn't it be a good idea to fix this anyway?

Best regards,
Byron Campen

Attachment: smime.p7s
Description: S/MIME cryptographic signature