summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2020-12-07 23:53:08 +0000
committerAdrian Thurston <thurston@colm.net>2020-12-07 23:53:08 +0000
commit7279749da5e988b0d25a980be969b63e71b1f026 (patch)
treee8e7914259e0b56707f7992e222d00c5be2153f2 /src
parent0cf396224409c6a3e3c0c4f252865f77bd4c6b5f (diff)
downloadcolm-7279749da5e988b0d25a980be969b63e71b1f026.tar.gz
don't leak the stream_impl::line_len array
Diffstat (limited to 'src')
-rw-r--r--src/stream.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stream.c b/src/stream.c
index 77779aae..4a179247 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -53,6 +53,7 @@ void stream_impl_push_line( struct stream_impl_data *ss, int ll )
int lines_alloc_new = ss->lines_alloc * 2;
int *line_len_new = malloc( sizeof(int) * lines_alloc_new );
memcpy( line_len_new, ss->line_len, sizeof(int) * ss->lines_alloc );
+ free( ss->line_len );
ss->lines_alloc = lines_alloc_new;
ss->line_len = line_len_new;
}
@@ -372,6 +373,9 @@ static void data_destructor( program_t *prg, tree_t **sp, struct stream_impl_dat
// if ( si->name != 0 )
// free( si->name );
+ if ( si->line_len != 0 )
+ free( si->line_len );
+
free( si );
}