diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-08-07 14:11:16 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-08-07 14:11:16 +0000 |
| commit | ef5c01ad3373fa329d5aafbc49f9fd6dfb3e55ab (patch) | |
| tree | a1e677ad4ff7854e29086003543ddda4bd19e81a /src/IteratableChunkChecksumValidator.cc | |
| parent | 09417a063607b76c9deb54cfec4c7ea42e90aae8 (diff) | |
2008-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed unmatched malloc/free.
* src/IteratableChunkChecksumValidator.cc
* src/IteratableChecksumValidator.cc
Diffstat (limited to 'src/IteratableChunkChecksumValidator.cc')
| -rw-r--r-- | src/IteratableChunkChecksumValidator.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/IteratableChunkChecksumValidator.cc b/src/IteratableChunkChecksumValidator.cc index f901f0ee..00429479 100644 --- a/src/IteratableChunkChecksumValidator.cc +++ b/src/IteratableChunkChecksumValidator.cc @@ -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(); } |
