summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-13 22:55:56 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-13 22:55:56 -0700
commit0cd861d195cf2f021f9e5c5c49b6f82dd9dfa993 (patch)
tree3bcfe2398c2f1debb39b9aaa0880058ce0372346
parente5226da128493945a2248331c6ad30f14f5ac7a2 (diff)
til_stream: assert when gc leaks in til_stream_free()
It's expected that all mondule contexts will have been cleaned up by the final gc in til_stream_free(). If the gc returns a non-zero skipped count, it suggests there's a program bug leaking registered contexts.
-rw-r--r--src/til_stream.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/til_stream.c b/src/til_stream.c
index 0f35a17..247dbf3 100644
--- a/src/til_stream.c
+++ b/src/til_stream.c
@@ -131,10 +131,13 @@ int til_stream_active(til_stream_t *stream)
til_stream_t * til_stream_free(til_stream_t *stream)
{
+ unsigned leaked;
+
if (!stream)
return NULL;
- til_stream_gc_module_contexts(stream);
+ leaked = til_stream_gc_module_contexts(stream);
+ assert(!leaked);
for (int i = 0; i < TIL_STREAM_PIPE_BUCKETS_COUNT; i++) {
for (til_stream_pipe_t *p = stream->pipe_buckets[i], *p_next; p != NULL; p = p_next) {
© All Rights Reserved