Fix memory leak in SFSIterate
authorteodor <teodor>
Thu, 2 Oct 2008 14:20:21 +0000 (14:20 +0000)
committerteodor <teodor>
Thu, 2 Oct 2008 14:20:21 +0000 (14:20 +0000)
sfxstr.c

index 4a4e4da..e9bc84a 100644 (file)
--- a/sfxstr.c
+++ b/sfxstr.c
@@ -799,8 +799,13 @@ SFSIterate(SFSTree *info, SFSDataIO *out) {
                return 1;
        }
 
-       if ( s == NULL || s->node == NULL)
+       if ( s == NULL )
                return 0;
+       if ( s->node == NULL ) {
+               info->stack = s->next;
+               tfree(s);
+               return SFSIterate(info, out);
+       }
                                                         
        while ( s->level + s->node->nchar + 1 >= info->tlen ) {
                info->tlen *= 2;