]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/network/serv_network.c
Fix possible double free during sending network error messages.
[citadel.git] / citadel / modules / network / serv_network.c
index fb5476cc913f479187a7f73d5f84ff5724f0a619..95d5b51e7021f1202d06519b754f805e2bd7aeb3 100644 (file)
@@ -111,13 +111,8 @@ int network_usetable(struct CtdlMessage *msg)
        time_t now;
 
        /* Bail out if we can't generate a message ID */
-       if (msg == NULL) {
-               return(0);
-       }
-       if (msg->cm_fields['I'] == NULL) {
-               return(0);
-       }
-       if (IsEmptyStr(msg->cm_fields['I'])) {
+       if ((msg == NULL) || (msg->cm_fields['I'] == NULL) || (IsEmptyStr(msg->cm_fields['I'])))
+       {
                return(0);
        }
 
@@ -393,10 +388,12 @@ void network_bounce(struct CtdlMessage *msg, char *reason)
         */
        if (msg->cm_fields['R'] == NULL) {
                free(msg->cm_fields['R']);
+               msg->cm_fields['R'] = NULL;
        }
 
        if (msg->cm_fields['D'] == NULL) {
                free(msg->cm_fields['D']);
+               msg->cm_fields['D'] = NULL;
        }
 
        snprintf(recipient, sizeof recipient, "%s@%s",