diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-08-14 08:20:52 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-08-14 08:25:42 -0700 |
commit | 7231e59fecf19de0077f8eae3baed952155fa62b (patch) | |
tree | 837771604cc2154f5e6c8236441bdbdf01da37d0 /src/modules/rkt | |
parent | 05fcdc986c2c3657f2c78eace807b2df8ef0b660 (diff) |
modules/rkt: wire up pipe_dtor to stop leaking rkt_pipe_t
On shutdown til_stream_untap_owner() will call into the pipe_dtor
hook if set. So until now this was just (harmlessly) leaking the
rkt_pipe_t allocated by the pipe_ctor hook on the road to process
exit.
But in the interests of silencing ASAN about leaks on graceful
exit, I'm tying up these loose ends.
This dtor will also be utilized for performing a FORGET_TRACK via
Rocket once that's a thing.
While here I also got rid of the pipe_dtor return value, as it's
unused with no clear potential purpose (for now).
Diffstat (limited to 'src/modules/rkt')
-rw-r--r-- | src/modules/rkt/rkt.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c index d5c42d5..3a48606 100644 --- a/src/modules/rkt/rkt.c +++ b/src/modules/rkt/rkt.c @@ -134,7 +134,7 @@ typedef struct rkt_pipe_t { } rkt_pipe_t; -int rkt_stream_pipe_ctor(void *context, til_stream_t *stream, const void *owner, const void *owner_foo, const char *parent_path, uint32_t parent_hash, const til_tap_t *tap, const void **res_owner, const void **res_owner_foo, const til_tap_t **res_driving_tap) +static int rkt_stream_pipe_ctor(void *context, til_stream_t *stream, const void *owner, const void *owner_foo, const char *parent_path, uint32_t parent_hash, const til_tap_t *tap, const void **res_owner, const void **res_owner_foo, const til_tap_t **res_driving_tap) { rkt_context_t *ctxt = context; rkt_pipe_t *rkt_pipe; @@ -165,10 +165,23 @@ int rkt_stream_pipe_ctor(void *context, til_stream_t *stream, const void *owner, return 1; } +static void rkt_stream_pipe_dtor(void *context, til_stream_t *stream, const void *owner, const void *owner_foo, const char *parent_path, const til_tap_t *tap) +{ + rkt_context_t *ctxt = context; + + assert(stream); + assert(tap); + + if (owner != ctxt) + return; /* not interesting to us */ + + free((void *)owner_foo); +} + static const til_stream_hooks_t rkt_stream_hooks = { .pipe_ctor = rkt_stream_pipe_ctor, - /* .pipe_dtor unneeded */ + .pipe_dtor = rkt_stream_pipe_dtor, }; |