Fixed a few mem leaks, and C++ compatibility
[SXSI/TextCollection.git] / lzindex / lztrie.c
index 0a4c56b..7e4453d 100644 (file)
@@ -59,6 +59,8 @@ lztrie buildLZTrie(byte *text, byte s, uint text_length)
     
     destroyTrie(T);
     LZT = createLZTrie(parent,letters,Node,n,text_length);
+
+    free(Node); Node = 0;
     return LZT;
  }
 
@@ -73,6 +75,7 @@ void destroyLZTrie(lztrie T)
     destroyNodemap(T->Node);
     destroyPosition(T->TPos);
     free(T->boost);
+    
     free(T);
  }
 
@@ -132,7 +135,7 @@ lztrie loadLZTrie (FILE *f)
     i = 1; // shortcut for first child of root
     while (i != 2*T->n-1) { // shortcut for its closing parenthesis
        T->boost[T->letters[i-rank(T->pdata->bdata,i)]] = i;
-       // shortcut for leftrankLZTrie
+      // shortcut for leftrankLZTrie
        i = findclose(T->pdata,i)+1;
     }