uprobe: fix memory leak
PATCH 6/6 uprobe: fix memory leak
Signed-off-by Kris Van Hees <[email protected]>
--- libdtrace/dt_prov_uprobe.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
libdtrace/dt_prov_uprobe.c +11 -3
@@ -434,6 +434,7 @@ static void probe_destroy_underlying(dtrace_hdl_t *dtp, void *datap)static void probe_destroy (dtrace_hdl_t *dtp,void *datap) {free_probe_list (dtp, datap); +dt_free (dtp, datap); }static void detach (dtrace_hdl_t *dtp,const dt_probe_t *uprp)
@@ -1701,8 +1702,14 @@ oom:return dt_set_errno (dtp,EDT_NOMEM ); } -/* Clean up the private provider data. */ -static void destroy (dtrace_hdl_t *dtp,void *arg) +/* Clean up the private uproobe provider data. */ +static void destroy_uprobe (dtrace_hdl_t *dtp,void *arg) +{ +dt_free (dtp, arg); +} + +/* Clean up the private USDT provider data. */ +static void destroy_usdt (dtrace_hdl_t *dtp,void *arg) {dt_htab_destroy ((dt_htab_t *)arg); }
@@ -1720,6 +1727,7 @@ dt_provimpl_t dt_uprobe = { .detach = &detach, .probe_destroy = &probe_destroy_underlying, .add_probe = &add_probe_uprobe, + .destroy = &destroy_uprobe, };/*
@@ -1746,7 +1754,7 @@ dt_provimpl_t dt_usdt = { .probe_destroy = &probe_destroy, .discover = &discover, .add_probe = &add_probe_usdt, - .destroy = &destroy, + .destroy = &destroy_usdt, };/*
Signature · 1 line
2.53.0
On 28 Apr 2026, Kris Van Hees verbalised:
Quoted 1 line
Signed-off-by Kris Van Hees <[email protected]>
Reviewed-by Nick Alcock <[email protected]>
(all seems to line up.)
Signature · 1 line
NULL && (void)