]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/smtp/serv_smtpqueue.c
libev/c-ares migration: unstack out ouf c-ares before querying new requests
[citadel.git] / citadel / modules / smtp / serv_smtpqueue.c
index 26c7e555dd47a7f141aae25da3fffb1ab236f4c4..591918ea200b5d3fc551e75e935a034770523841 100644 (file)
@@ -140,9 +140,13 @@ void RemoveQItem(OneQueItem *MyQItem)
 
 void FreeURL(ParsedURL** Url)
 {
-       FreeStrBuf(&(*Url)->URL);
-       free(*Url);
-       *Url = NULL;
+       if (*Url != NULL) {
+               FreeStrBuf(&(*Url)->URL);
+               if ((*Url)->Next != NULL)
+                       FreeURL(&(*Url)->Next);
+               free(*Url);
+               *Url = NULL;
+       }
 }
 
 void FreeMailQEntry(void *qv)
@@ -416,7 +420,7 @@ StrBuf *smtp_load_msg(OneQueItem *MyQItem, int n)
        if ((StrLength(SendMsg) > 0) && 
            ChrPtr(SendMsg)[StrLength(SendMsg) - 1] != '\n') {
                CtdlLogPrintf(CTDL_WARNING, 
-                             "SMTP client[%ld]: Possible problem: message did not "
+                             "SMTP client[%d]: Possible problem: message did not "
                              "correctly terminate. (expecting 0x10, got 0x%02x)\n",
                              MsgCount, //yes uncool, but best choice here... 
                              ChrPtr(SendMsg)[StrLength(SendMsg) - 1] );
@@ -645,9 +649,11 @@ int ParseURL(ParsedURL **Url, StrBuf *UrlStr, short DefaultPort)
                url->Host ++;
                pEndHost = strchr(url->Host, ']');
                if (pEndHost == NULL) {
+                       FreeStrBuf(&url->URL);
                        free(url);
                        return 0; /* invalid syntax, no ipv6 */
                }
+               StrBufPeek(url->URL, pEndHost, 0, '\0');
                if (*(pEndHost + 1) == ':'){
                        StrBufPeek(url->URL, pEndHost + 1, 0, '\0');
                        pPort = pEndHost + 2;