summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-01-01 21:31:47 +0000
committerAdrian Thurston <thurston@complang.org>2012-01-01 21:31:47 +0000
commit63bd98f696564ccba87b61aa2e608c447510a97a (patch)
treec3adec38944c21bcfe089751d8d22779fba5e42a
parentab4266db27d12e5a406af9c971663f580daca8f1 (diff)
downloadcolm-63bd98f696564ccba87b61aa2e608c447510a97a.tar.gz
Downref the accum stream when downreffing the accumulator.
-rw-r--r--colm/bytecode.c3
-rw-r--r--colm/tree.c8
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 );