]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/smtp/serv_smtpeventclient.c
Fix Crash
[citadel.git] / citadel / modules / smtp / serv_smtpeventclient.c
index 15a55e79960758b4237ccdbf1b209c9dc6fab30b..85ef2813bcec4144077031c14594c8c7c723bb90 100644 (file)
@@ -158,6 +158,8 @@ void FinalizeMessageSend(SmtpOutMsg *Msg)
 
                RemoveQItem(Msg->MyQItem);
        }
+
+       RemoveContext(Msg->IO.CitContext);
        DeleteSmtpOutMsg(Msg);
 }
 
@@ -168,8 +170,9 @@ eNextState FailOneAttempt(AsyncIO *IO)
         * possible ways here: 
         * - connection timeout 
         * - 
-        */     
-       SendMsg->pCurrRelay = SendMsg->pCurrRelay->Next;
+        */
+       if (SendMsg->pCurrRelay != NULL)
+               SendMsg->pCurrRelay = SendMsg->pCurrRelay->Next;
 
        if (SendMsg->pCurrRelay == NULL)
                return eAbort;
@@ -450,9 +453,10 @@ void smtp_try_one_queue_entry(OneQueItem *MyQItem,
        else             SendMsg->msgtext = NewStrBufDup(MsgText);
        
        if (smtp_resolve_recipients(SendMsg)) {
-
-               
-
+               CitContext *SubC;
+               SubC = CloneContext (CC);
+               SubC->session_specific_data = (char*) SendMsg;
+               SendMsg->IO.CitContext = SubC;
 
                if (SendMsg->pCurrRelay == NULL)
                        QueueEventContext(&SendMsg->IO,
@@ -491,8 +495,10 @@ void smtp_try_one_queue_entry(OneQueItem *MyQItem,
 
 void SMTPSetTimeout(eNextState NextTCPState, SmtpOutMsg *pMsg)
 {
+       double Timeout = 0.0;
+
        CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
-       double Timeout;
+
        switch (NextTCPState) {
        case eSendReply:
        case eSendMore: