Browse Source

2008-05-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Use free() to deallocate memory for _buffer if 
HAVE_POSIX_MEMALIGN is
	defined.
	* src/SingleFileAllocationIterator.cc 
(~SingleFileAllocationIterator)
Tatsuhiro Tsujikawa 17 years ago
parent
commit
148b1baf38
2 changed files with 11 additions and 0 deletions
  1. 6 0
      ChangeLog
  2. 5 0
      src/SingleFileAllocationIterator.cc

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2008-05-15  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Use free() to deallocate memory for _buffer if HAVE_POSIX_MEMALIGN is
+	defined.
+	* src/SingleFileAllocationIterator.cc (~SingleFileAllocationIterator)
+
 2008-05-15  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Use erase+lower_bound+insert instead of sort.

+ 5 - 0
src/SingleFileAllocationIterator.cc

@@ -37,6 +37,7 @@
 #include "Util.h"
 #include "a2io.h"
 #include <cstring>
+#include <cstdlib>
 
 namespace aria2 {
 
@@ -52,7 +53,11 @@ SingleFileAllocationIterator::SingleFileAllocationIterator(BinaryStream* stream,
 
 SingleFileAllocationIterator::~SingleFileAllocationIterator()
 {
+#ifdef HAVE_POSIX_MEMALIGN
+  free(_buffer);
+#else
   delete [] _buffer;
+#endif // HAVE_POSIX_MEMALIGN
 }
 
 void SingleFileAllocationIterator::init()