title: iPhone & Mailcore memory leak problem
body: <p>In the app I'm currently working, I use Mailcore (<a href="http://www.mronge.com/m/MailCore/API/" rel="nofollow">http://www.mronge.com/m/MailCore/API/</a>) to handle mail server operations. I'm trying to send a message over an SMTP connection in the background. The problem is, Leaks is telling me that I get a decent amount of memory leaks every time a message sends. I'm trying to figure if this is my fault or Mailcore's fault. Here's the code:</p>
  
  <p>From my view controller:</p>
  
  <pre><code>-(void) send_rfq {
  
      CTCoreMessage *repMsg = [[[CTCoreMessage alloc] init] autorelease];
      NSDate *now = [NSDate date];
  
      NSString* msgString = [NSString stringWithFormat:@"Date#%@\nRFQ#%@\nSalesRep#%@",[now description], [rfq_entry get_uid],[rfq_entry get_repid]];
      [repMsg setBody:msgString];
      [repMsg setSubject:@"RFQ Assign"];
  
      [myAppDelegate performSelectorInBackground:@selector(send_msg:) withObject:repMsg];
  
      [self.navigationController popViewControllerAnimated:YES]; 
  }
  </code></pre>
  
  <p>From my app delegate:</p>
  
  <pre><code>-(BOOL) send_bg:(CTCoreMessage*) msg {
      BOOL success = TRUE;
      @try {
          [CTSMTPConnection sendMessage:msg server:smtp_server username:smtp_uname password:smtp_pass port:smtp_port useTLS:smtp_tls useAuth:smtp_auth];
      }
      @catch (NSException * e) {
          //Msg failed to send;
          success = FALSE;
      }
      return success;
  }
  
  -(void) send_msg:(CTCoreMessage*) msg {
      NSAutoreleasePool *pool = [ [NSAutoreleasePool alloc] init];
      [msg setTo:[NSSet setWithObject:[CTCoreAddress addressWithName:@"testaccount" email:rfq_dest]]];
      [msg setFrom:[NSSet setWithObject:[CTCoreAddress addressWithName:@"RFQapp" email:rfq_src]]];
      if(![self send_bg:msg]) {
          UIAlertView * empty_alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not send." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
          [empty_alert show];
          [empty_alert autorelease];
      }
      [pool release];
  }
  </code></pre>