]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/imap/imap_fetch.c
we need to free the array _after_ releasing the array entries
[citadel.git] / citadel / modules / imap / imap_fetch.c
index b9319610c8f0ed1e19ee07c8cdd8e14f45beeb3e..ed7f271651c79a7c71dc1801c8747fbfc7fd6240 100644 (file)
@@ -110,7 +110,7 @@ void imap_fetch_internaldate(struct CtdlMessage *msg) {
        time_t msgdate;
 
        if (!msg) return;
-       if (msg->cm_fields[eTimestamp] != NULL) {
+       if (!CM_IsEmpty(msg, eTimestamp)) {
                msgdate = atol(msg->cm_fields[eTimestamp]);
        }
        else {
@@ -359,7 +359,7 @@ void imap_output_envelope_from(struct CtdlMessage *msg) {
        IAPuts(" NIL ");        /* source route (not used) */
 
 
-       if (msg->cm_fields[erFc822Addr] != NULL) {
+       if (!CM_IsEmpty(msg, erFc822Addr)) {
                process_rfc822_addr(msg->cm_fields[erFc822Addr], user, node, name);
                plain_imap_strout(user);                /* mailbox name (user id) */
                IAPuts(" ");
@@ -445,7 +445,7 @@ void imap_fetch_envelope(struct CtdlMessage *msg) {
        if (!msg) return;
 
        /* Parse the message date into an IMAP-format date string */
-       if (msg->cm_fields[eTimestamp] != NULL) {
+       if (!CM_IsEmpty(msg, eTimestamp)) {
                msgdate = atol(msg->cm_fields[eTimestamp]);
        }
        else {
@@ -790,7 +790,7 @@ void imap_fetch_body(long msgnum, ConstStr item, int is_peek) {
        iaputs(&Imap->cached_body[pstart], pbytes);
 
        if (msg != NULL) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
 
        /* Mark this message as "seen" *unless* this is a "peek" operation */
@@ -1084,7 +1084,7 @@ void imap_do_fetch_msg(int seq, citimap_command *Cmd) {
                 */
                else if (!strcasecmp(Cmd->Params[i].Key, "BODYSTRUCTURE")) {
                        if ((msg != NULL) && (!body_loaded)) {
-                               CtdlFreeMessage(msg);   /* need the whole thing */
+                               CM_Free(msg);   /* need the whole thing */
                                msg = NULL;
                        }
                        if (msg == NULL) {
@@ -1115,7 +1115,7 @@ void imap_do_fetch_msg(int seq, citimap_command *Cmd) {
        IAPuts(")\r\n");
        unbuffer_output();
        if (msg != NULL) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
 }