Browse Source

Fixed get_dlnext(), it now points to the data part of a block, not the header.

Ioannis Koutras 13 years ago
parent
commit
5a090e692e
2 changed files with 2 additions and 2 deletions
  1. 1 1
      private-include/block_header.h
  2. 1 1
      src/block_header.c

+ 1 - 1
private-include/block_header.h

@@ -212,7 +212,7 @@ void * get_dlprevious(void *ptr);
  * \param allocator 	The pointer to the allocator who manages the block.
  * \param ptr 		The pointer to the data part of the current memory block.
  *
- * \return The pointer to the next block.
+ * \return The pointer to the data part of the next block.
  * \retval NULL There is no next block.
  */
 void * get_dlnext(allocator_t *allocator, void *ptr);

+ 1 - 1
src/block_header.c

@@ -134,7 +134,7 @@ void * get_dlprevious(void *ptr) {
 
 void * get_dlnext(allocator_t *allocator, void *ptr) {
     if(allocator->border_ptr != ptr) {
-        return (void *) ((char *) ptr + get_size(ptr));
+        return (void *) ((char *) ptr + get_size(ptr)) + HEADER_SIZE;
     } else {
         return NULL;
     }