Fixed a few mem leaks, and C++ compatibility
[SXSI/TextCollection.git] / lzindex / hash.c
index 272fbee..754f327 100644 (file)
@@ -8,9 +8,10 @@
 
 hash createHash (uint n, uint vbits, float factor)
    
-   { hash H = malloc (sizeof(struct shash));
+   { 
      int i,N;
      if (n == 0) return NULL;
+     hash H = malloc (sizeof(struct shash));
      N = n*factor; if (N <= n) N = n+1;
      H->size = (1 << bits(N-1)) - 1;
      H->bits = vbits;