]> code.citadel.org Git - citadel.git/commitdiff
* Hand over IM conversation memory with SmashStrBuf()
authorArt Cancro <ajc@citadel.org>
Thu, 24 Sep 2009 21:34:59 +0000 (21:34 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 24 Sep 2009 21:34:59 +0000 (21:34 +0000)
citadel/modules/chat/serv_chat.c

index 555998ef95bf5f1aade503ad794f491a2ec0d7b6..254605045938ecd2ac96289055b6edd641ddc8d5 100644 (file)
@@ -865,7 +865,7 @@ void flush_individual_conversation(struct imlog *im) {
        }
        msg->cm_fields['O'] = strdup(PAGELOGROOM);
        msg->cm_fields['N'] = strdup(NODENAME);
-       msg->cm_fields['M'] = strdup(ChrPtr(im->conversation));
+       msg->cm_fields['M'] = SmashStrBuf(&im->conversation);   /* we own this memory now */
 
        /* Start with usernums[1] because it's guaranteed to be higher than usernums[0],
         * so if there's only one party, usernums[0] will be zero but usernums[1] won't.
@@ -932,10 +932,9 @@ void flush_conversations_to_disk(time_t if_older_than) {
         */
        while (flush_these) {
 
-               flush_individual_conversation(flush_these);
+               flush_individual_conversation(flush_these);     /* This will free the string buffer */
                imptr = flush_these;
                flush_these = flush_these->next;
-               FreeStrBuf(&imptr->conversation);
                free(imptr);
        }
 }