History

leaf free error check fix

Matthew Wang committed 6 years ago

Commit 4e40b211 parent 17acc7e2 files · +6 −6Browse files

Unified · Split

2 files
  1. leaf/Inc/leaf-analysis.h +2 −2
  2. leaf/Src/leaf-mempool.c +4 −4
leaf/Inc/leaf-analysis.h+2−2
@@ -285,8 +285,8 @@ extern "C" { · 284 unmodified lines
285 void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs);285 void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs);
286 void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws);286 void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws);
287 void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold);287 void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold);
288 void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha);288 void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha);
289 void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance);289 void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance);
290 290
291 //==============================================================================291 //==============================================================================
292 292
leaf/Src/leaf-mempool.c+4−4
@@ -261,15 +261,15 @@ 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 ||264 if ((long) other_node < (long) pool->mpool ||
265 (char*)other_node >= ((char*)pool->head + pool->msize))265 (long) other_node >= (((long) pool->mpool) + pool->msize))
266 {266 {
267 LEAF_error(2);267 LEAF_error(2);
268 return;268 return;
269 }269 }
270 next_node = other_node->next;270 next_node = other_node->next;
271 // Check if a node is directly after the freed node271 // Check if a node is directly after the freed node
272 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)
273 {273 {
274 // Increase freed node's size274 // Increase freed node's size
275 freed_node->size += leaf.header_size + other_node->size;275 freed_node->size += leaf.header_size + other_node->size;
@@ -280,7 +280,7 @@ void mpool_free(char* ptr, _tMempool* pool) · 4 unmodified lines
280 }280 }
281 281
282 // Check if a node is directly before the freed node282 // Check if a node is directly before the freed node
283 else if ((long) other_node + (leaf.header_size + other_node->size) == (long) freed_node)283 else if (((long) other_node) + (leaf.header_size + other_node->size) == (long) freed_node)
284 {284 {
285 // Increase the merging node's size285 // Increase the merging node's size
286 other_node->size += leaf.header_size + freed_node->size;286 other_node->size += leaf.header_size + freed_node->size;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t