Unified · Split
| @@ -261,6 +261,12 @@ void mpool_free(char* ptr, _tMempool* pool) · 260 unmodified lines | |||
| 261 | mpool_node_t* next_node; | 261 | mpool_node_t* next_node; |
| 262 | while (other_node != NULL) | 262 | while (other_node != NULL) |
| 263 | { | 263 | { |
| 264 | if ((char*)other_node < (char*)pool->head || | ||
| 265 | (char*)other_node >= ((char*)pool->head + pool->msize)) | ||
| 266 | { | ||
| 267 | LEAF_error(2); | ||
| 268 | return; | ||
| 269 | } | ||
| 264 | next_node = other_node->next; | 270 | next_node = other_node->next; |
| 265 | // Check if a node is directly after the freed node | 271 | // Check if a node is directly after the freed node |
| 266 | if ((long) freed_node + (leaf.header_size + freed_node->size) == (long) other_node) | 272 | if ((long) freed_node + (leaf.header_size + freed_node->size) == (long) other_node) |
| @@ -54,7 +54,8 @@ float LEAF_getSampleRate() · 53 unmodified lines | |||
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | //implement a function called this in your user code to catch errors | 56 | //implement a function called this in your user code to catch errors |
| 57 | __attribute__((weak)) uint8_t LEAF_error(uint8_t whichone) | 57 | //__attribute__((weak)) |
| 58 | uint8_t LEAF_error(uint8_t whichone) | ||
| 58 | { | 59 | { |
| 59 | return whichone; | 60 | return whichone; |
| 60 | } | 61 | } |
| @@ -140,7 +140,8 @@ extern "C" { · 139 unmodified lines | |||
| 140 | float LEAF_getSampleRate (void); | 140 | float LEAF_getSampleRate (void); |
| 141 | 141 | ||
| 142 | 142 | ||
| 143 | __attribute__((weak)) uint8_t LEAF_error(uint8_t whichone); | 143 | // __attribute__((weak)) |
| 144 | uint8_t LEAF_error(uint8_t whichone); | ||
| 144 | 145 | ||
| 145 | /*! | 146 | /*! |
| 146 | * @} | 147 | * @} |