mirror of https://github.com/aria2/aria2
2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed unmatched malloc/free. * src/IteratableChunkChecksumValidator.cc * src/IteratableChecksumValidator.ccpull/1/head
parent
09417a0636
commit
ef5c01ad33
|
@ -1,3 +1,9 @@
|
|||
2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Fixed unmatched malloc/free.
|
||||
* src/IteratableChunkChecksumValidator.cc
|
||||
* src/IteratableChecksumValidator.cc
|
||||
|
||||
2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Removed max chunk size check. This change fixes BUG#2040169
|
||||
|
|
|
@ -59,7 +59,11 @@ IteratableChecksumValidator::IteratableChecksumValidator(const SingleFileDownloa
|
|||
|
||||
IteratableChecksumValidator::~IteratableChecksumValidator()
|
||||
{
|
||||
#ifdef HAVE_POSIX_MEMALIGN
|
||||
free(_buffer);
|
||||
#else // !HAVE_POSIX_MEMALIGN
|
||||
delete [] _buffer;
|
||||
#endif // !HAVE_POSIX_MEMALIGN
|
||||
}
|
||||
|
||||
void IteratableChecksumValidator::validateChunk()
|
||||
|
@ -100,10 +104,12 @@ uint64_t IteratableChecksumValidator::getTotalLength() const
|
|||
void IteratableChecksumValidator::init()
|
||||
{
|
||||
#ifdef HAVE_POSIX_MEMALIGN
|
||||
free(_buffer);
|
||||
_buffer = (unsigned char*)Util::allocateAlignedMemory(ALIGNMENT, BUFSIZE);
|
||||
#else
|
||||
#else // !HAVE_POSIX_MEMALIGN
|
||||
delete [] _buffer;
|
||||
_buffer = new unsigned char[BUFSIZE];
|
||||
#endif // HAVE_POSIX_MEMALIGN
|
||||
#endif // !HAVE_POSIX_MEMALIGN
|
||||
_pieceStorage->getDiskAdaptor()->enableDirectIO();
|
||||
_currentOffset = 0;
|
||||
_ctx.reset(new MessageDigestContext());
|
||||
|
|
|
@ -66,7 +66,11 @@ IteratableChunkChecksumValidator(const DownloadContextHandle& dctx,
|
|||
|
||||
IteratableChunkChecksumValidator::~IteratableChunkChecksumValidator()
|
||||
{
|
||||
#ifdef HAVE_POSIX_MEMALIGN
|
||||
free(_buffer);
|
||||
#else // !HAVE_POSIX_MEMALIGN
|
||||
delete [] _buffer;
|
||||
#endif // !HAVE_POSIX_MEMALIGN
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,10 +119,12 @@ std::string IteratableChunkChecksumValidator::calculateActualChecksum()
|
|||
void IteratableChunkChecksumValidator::init()
|
||||
{
|
||||
#ifdef HAVE_POSIX_MEMALIGN
|
||||
free(_buffer);
|
||||
_buffer = (unsigned char*)Util::allocateAlignedMemory(ALIGNMENT, BUFSIZE);
|
||||
#else
|
||||
#else // !HAVE_POSIX_MEMALIGN
|
||||
delete [] _buffer;
|
||||
_buffer = new unsigned char[BUFSIZE];
|
||||
#endif // HAVE_POSIX_MEMALIGN
|
||||
#endif // !HAVE_POSIX_MEMALIGN
|
||||
if(_dctx->getFileEntries().size() == 1) {
|
||||
_pieceStorage->getDiskAdaptor()->enableDirectIO();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue