From 64bd6d96512abc3b406c127f76888a9ba4729559 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 18 Aug 2010 16:25:31 +0000 Subject: [PATCH] Fix CID 890. dest was leaked on error. To me it seems that src is leaked too, and there's even a comment that says we are leaking memory. Coverity doesn't complain, though, so I wonder if I'm wrong. Please someone have a second look. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38241 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/mail/MailAttachment.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kits/mail/MailAttachment.cpp b/src/kits/mail/MailAttachment.cpp index f05f0611eb..12faa37cda 100644 --- a/src/kits/mail/MailAttachment.cpp +++ b/src/kits/mail/MailAttachment.cpp @@ -369,8 +369,10 @@ status_t BSimpleMailAttachment::RenderToRFC822(BPositionIO *render_to) { return B_NO_MEMORY; destSize = encode (_encoding, dest, src, read, false /* headerMode */); - if (destSize < B_OK) + if (destSize < B_OK) { + free(dest); return destSize; + } if (destSize > 0) read = render_to->Write(dest,destSize); free (src);