* valgrind cleanup
authorWilfried Göesgens <willi@citadel.org>
Sat, 29 Nov 2008 10:53:19 +0000 (10:53 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 29 Nov 2008 10:53:19 +0000 (10:53 +0000)
webcit/messages.c
webcit/msg_renderers.c
webcit/roomops.c
webcit/subst.c

index 03eaad55de22e4a00235fd993a489631620363cc..df19657371113dcb675d695cd4aeddb9e50ea628 100644 (file)
@@ -353,7 +353,6 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, in
        if (Msg->AllAttach == NULL)
                Msg->AllAttach = NewHash(1,NULL);
        Put(Msg->AllAttach, SKEY(Msg->MsgBody->PartNum), Msg->MsgBody, DestroyMime);
-
        
        /* strip the bare contenttype, so we ommit charset etc. */
        StrBufExtract_token(Buf, Msg->MsgBody->ContentType, 0, ';');
index 1fb5739db6e8d5a5a2d2d1125cd343297a527ed3..b64b892afc11d739492bb95d2bf5d4c4b1d78802 100644 (file)
@@ -401,7 +401,8 @@ void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime)
                if (Msg->AttachLinks == NULL)
                        Msg->AttachLinks = NewHash(1,NULL);
                Put(Msg->AttachLinks, SKEY(Mime->PartNum), Mime, reference_free_handler);
-               if (strcasecmp(ChrPtr(Mime->ContentType), "application/octet-stream") == 0) {
+               if ((strcasecmp(ChrPtr(Mime->ContentType), "application/octet-stream") == 0) && 
+                   (StrLength(Mime->FileName) > 0)) {
                        FlushStrBuf(Mime->ContentType);
                        StrBufAppendBufPlain(Mime->ContentType,
                                             GuessMimeByFilename(SKEY(Mime->FileName)),
@@ -582,11 +583,12 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
        StrBuf *cs = NULL;
        const char *ptr, *pte;
        const char *BufPtr = NULL;
-       StrBuf *Line = NewStrBuf();
-       StrBuf *Line1 = NewStrBuf();
-       StrBuf *Line2 = NewStrBuf();
-       StrBuf *Target = NewStrBufPlain(NULL, StrLength(Mime->Data));
-       int ConvertIt = 1;
+       StrBuf *Line;
+       StrBuf *Line1;
+       StrBuf *Line2;
+       StrBuf *Target;
+
+       int ConvertIt = 0;
        int bn = 0;
        int bq = 0;
        int i, n, done = 0;
@@ -627,6 +629,10 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
                }
        }
 #endif
+       Line = NewStrBuf();
+       Line1 = NewStrBuf();
+       Line2 = NewStrBuf();
+       Target = NewStrBufPlain(NULL, StrLength(Mime->Data));
 
        while ((n = StrBufSipLine(Line, Mime->Data, &BufPtr), n >= 0) && !done)
        {
index 2f4b0f1dff9a4104b31e58910321f4b3f3542015..24bf10eaf2be3d61169b1c159e91273b858fcf31 100644 (file)
@@ -3659,6 +3659,7 @@ void tmplput_RoomName(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *
        StrBuf *tmp;
        tmp = NewStrBufPlain(WC->wc_roomname, -1);;
        StrBufAppendTemplate(Target, nArgs, Tokens, Context, ContextType, tmp, 0);
+       FreeStrBuf(&tmp);
 }
 
 void _gotonext(void) { slrp_highest(); gotonext(); }
index ca532a469566e6cd0fc1ecea299b729098c212cf..320bd76c570473d09bdfb67fd97569cfada9fec9 100644 (file)
@@ -489,7 +489,7 @@ void StrBufAppendTemplate(StrBuf *Target,
        {
        case 'H':
                WCC = WC;
-               Buf = NewStrBufPlain(NULL, StrLength(Buf));
+               Buf = NewStrBufPlain(NULL, StrLength(Source));
                StrBuf_RFC822_to_Utf8(Buf, 
                                      Source, 
                                      (WCC!=NULL)? WCC->DefaultCharset : NULL,