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
285285 void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs);
286286 void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws);
287287 void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold);
288− void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha);
289− void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance);
288+ void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha);
289+ void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance);
290290
291291 //==============================================================================
292292
leaf/Src/leaf-mempool.c+4−4
@@ -261,15 +261,15 @@ void mpool_free(char* ptr, _tMempool* pool) · 260 unmodified lines
261261 mpool_node_t* next_node;
262262 while (other_node != NULL)
263263 {
264− if ((char*)other_node < (char*)pool->head ||
265− (char*)other_node >= ((char*)pool->head + pool->msize))
264+ if ((long) other_node < (long) pool->mpool ||
265+ (long) other_node >= (((long) pool->mpool) + pool->msize))
266266 {
267267 LEAF_error(2);
268268 return;
269269 }
270270 next_node = other_node->next;
271271 // 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)
273273 {
274274 // Increase freed node's size
275275 freed_node->size += leaf.header_size + other_node->size;
@@ -280,7 +280,7 @@ void mpool_free(char* ptr, _tMempool* pool) · 4 unmodified lines
280280 }
281281
282282 // 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)
284284 {
285285 // Increase the merging node's size
286286 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