diff options
author | Adrian Thurston <thurston@complang.org> | 2012-01-01 21:31:47 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2012-01-01 21:31:47 +0000 |
commit | 63bd98f696564ccba87b61aa2e608c447510a97a (patch) | |
tree | c3adec38944c21bcfe089751d8d22779fba5e42a | |
parent | ab4266db27d12e5a406af9c971663f580daca8f1 (diff) | |
download | colm-63bd98f696564ccba87b61aa2e608c447510a97a.tar.gz |
Downref the accum stream when downreffing the accumulator.
-rw-r--r-- | colm/bytecode.c | 3 | ||||
-rw-r--r-- | colm/tree.c | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/colm/bytecode.c b/colm/bytecode.c index bf93faeb..290819fa 100644 --- a/colm/bytecode.c +++ b/colm/bytecode.c @@ -2742,9 +2742,10 @@ again: debug( REALM_BYTECODE, "IN_CONS_ACCUM_STREAM\n" ); AccumStream *accumStream = accumStreamAllocate( prg ); + accumStream->refs = 1; + accumStream->id = LEL_ID_ACCUM_STREAM; accumStream->in = malloc( sizeof(InputStream) ); initInputStream( accumStream->in ); - accumStream->refs = 1; vm_push( (Tree*) accumStream ); break; diff --git a/colm/tree.c b/colm/tree.c index 73eb7ea7..22aeea12 100644 --- a/colm/tree.c +++ b/colm/tree.c @@ -868,10 +868,9 @@ free_tree: Accum *accum = (Accum*)tree; clearFsmRun( prg, accum->fsmRun ); clearPdaRun( prg, sp, accum->pdaRun ); - //treeDownref( prg, accum->accumStream ); free( accum->pdaRun ); free( accum->fsmRun ); - //free( accum->accumStream->in ); + treeDownref( prg, sp, (Tree*)accum->accumStream ); mapElFree( prg, (MapEl*)accum ); } else { @@ -895,6 +894,11 @@ free_tree: fclose( s->file ); streamFree( prg, s ); } + else if ( tree->id == LEL_ID_ACCUM_STREAM ) { + AccumStream *s = (AccumStream*)tree; + free( s->in ); + accumStreamFree( prg, s ); + } else { if ( tree->id != LEL_ID_IGNORE_LIST ) stringFree( prg, tree->tokdata ); |