* Stefano was right, there was another leak - I've fixed them all now in a
nicer way. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38244 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,7 +5,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
|
|||||||
if $(TARGET_PLATFORM) != haiku {
|
if $(TARGET_PLATFORM) != haiku {
|
||||||
UsePublicHeaders mail ;
|
UsePublicHeaders mail ;
|
||||||
}
|
}
|
||||||
UsePrivateHeaders mail ;
|
UsePrivateHeaders mail shared ;
|
||||||
UsePublicHeaders [ FDirName add-ons mail_daemon ] ;
|
UsePublicHeaders [ FDirName add-ons mail_daemon ] ;
|
||||||
|
|
||||||
if $(CHECK_MALLOC) {
|
if $(CHECK_MALLOC) {
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
class _EXPORT BSimpleMailAttachment;
|
class _EXPORT BSimpleMailAttachment;
|
||||||
class _EXPORT BAttributedMailAttachment;
|
class _EXPORT BAttributedMailAttachment;
|
||||||
class _EXPORT BMailAttachment;
|
class _EXPORT BMailAttachment;
|
||||||
@@ -352,11 +354,13 @@ status_t BSimpleMailAttachment::RenderToRFC822(BPositionIO *render_to) {
|
|||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
MemoryDeleter sourceDeleter(src);
|
||||||
|
|
||||||
_data->Seek(0,SEEK_SET);
|
_data->Seek(0,SEEK_SET);
|
||||||
|
|
||||||
ssize_t read = _data->Read(src,size);
|
ssize_t read = _data->Read(src,size);
|
||||||
if (read < B_OK)
|
if (read < B_OK)
|
||||||
return read; // Return an error code and leak memory.
|
return read;
|
||||||
|
|
||||||
// The encoded text will never be more than twice as large with any
|
// The encoded text will never be more than twice as large with any
|
||||||
// conceivable encoding. But just in case, there's a function call which
|
// conceivable encoding. But just in case, there's a function call which
|
||||||
@@ -368,15 +372,15 @@ status_t BSimpleMailAttachment::RenderToRFC822(BPositionIO *render_to) {
|
|||||||
if (dest == NULL)
|
if (dest == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
MemoryDeleter destinationDeleter(dest);
|
||||||
|
|
||||||
destSize = encode (_encoding, dest, src, read, false /* headerMode */);
|
destSize = encode (_encoding, dest, src, read, false /* headerMode */);
|
||||||
if (destSize < B_OK) {
|
if (destSize < B_OK)
|
||||||
free(dest);
|
|
||||||
return destSize;
|
return destSize;
|
||||||
}
|
|
||||||
if (destSize > 0)
|
if (destSize > 0)
|
||||||
read = render_to->Write(dest,destSize);
|
read = render_to->Write(dest,destSize);
|
||||||
free (src);
|
|
||||||
free (dest);
|
|
||||||
return (read > 0) ? B_OK : read;
|
return (read > 0) ? B_OK : read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user