Fix memory leaks in the networker
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 19 Sep 2011 21:18:24 +0000 (21:18 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 19 Sep 2011 21:32:49 +0000 (21:32 +0000)
citadel/modules/network/serv_netmail.c

index e46a1dfde1c061f70753489f9709574f1b690ed9..90e4e6891f41f272fca90b115f2052dd700b1d1d 100644 (file)
@@ -291,6 +291,8 @@ void network_spool_msg(long msgnum,
                        char *pCh;
                        StrBuf *Subject, *FlatSubject;
 
+                       if (msg->cm_fields['K'] != NULL)
+                               free(msg->cm_fields['K']);
                        if (msg->cm_fields['V'] == NULL){
                                /* local message, no enVelope */
                                StrBuf *Buf;
@@ -464,7 +466,7 @@ void network_spool_msg(long msgnum,
                                 */
                                for (nptr = sc->participates; nptr != NULL; nptr = nptr->next) {
 
-                                       if (msg->cm_fields['R'] == NULL) {
+                                       if (msg->cm_fields['R'] != NULL) {
                                                free(msg->cm_fields['R']);
                                        }
                                        msg->cm_fields['R'] = strdup(nptr->name);