From 6798c98060a6f1395b8e6528508be4f64d23fa0d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 29 Nov 2008 10:53:19 +0000 Subject: [PATCH] * valgrind cleanup --- webcit/messages.c | 1 - webcit/msg_renderers.c | 18 ++++++++++++------ webcit/roomops.c | 1 + webcit/subst.c | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/webcit/messages.c b/webcit/messages.c index 03eaad55d..df1965737 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -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, ';'); diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 1fb5739db..b64b892af 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -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) { diff --git a/webcit/roomops.c b/webcit/roomops.c index 2f4b0f1df..24bf10eaf 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -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(); } diff --git a/webcit/subst.c b/webcit/subst.c index ca532a469..320bd76c5 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -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, -- 2.39.2