shithub: leaf

Download patch

ref: 4e40b211ed031504c54b7865975a264687cef32b
parent: 17acc7ebe11380c9ad4ad92e8e005ec6d1d2a062
author: Matthew Wang <mjw7@princeton.edu>
date: Thu Jun 18 07:09:28 EDT 2020

leaf free error check fix

--- a/leaf/Inc/leaf-analysis.h
+++ b/leaf/Inc/leaf-analysis.h
@@ -285,8 +285,8 @@
     void    tPeriodDetection_setHopSize         (tPeriodDetection* const, int hs);
     void    tPeriodDetection_setWindowSize      (tPeriodDetection* const, int ws);
     void    tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold);
-    void     tPeriodDetection_setAlpha            (tPeriodDetection* const, float alpha);
-    void     tPeriodDetection_setTolerance        (tPeriodDetection* const, float tolerance);
+    void    tPeriodDetection_setAlpha           (tPeriodDetection* const, float alpha);
+    void    tPeriodDetection_setTolerance       (tPeriodDetection* const, float tolerance);
     
     //==============================================================================
     
--- a/leaf/Src/leaf-mempool.c
+++ b/leaf/Src/leaf-mempool.c
@@ -261,8 +261,8 @@
     mpool_node_t* next_node;
     while (other_node != NULL)
     {
-        if ((char*)other_node < (char*)pool->head ||
-            (char*)other_node >= ((char*)pool->head + pool->msize))
+        if ((long) other_node < (long) pool->mpool ||
+            (long) other_node >= (((long) pool->mpool) + pool->msize))
         {
             LEAF_error(2);
             return;
@@ -269,7 +269,7 @@
         }
         next_node = other_node->next;
         // Check if a node is directly after the freed node
-        if ((long) freed_node + (leaf.header_size + freed_node->size) == (long) other_node)
+        if (((long) freed_node) + (leaf.header_size + freed_node->size) == (long) other_node)
         {
             // Increase freed node's size
             freed_node->size += leaf.header_size + other_node->size;
@@ -280,7 +280,7 @@
         }
         
         // Check if a node is directly before the freed node
-        else if ((long) other_node + (leaf.header_size + other_node->size) == (long) freed_node)
+        else if (((long) other_node) + (leaf.header_size + other_node->size) == (long) freed_node)
         {
             // Increase the merging node's size
             other_node->size += leaf.header_size + freed_node->size;