Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 6/6] uprobe: fix memory leak
Date: Tue, 28 Apr 2026 19:05:29 +0000	[thread overview]
Message-ID: <ba06591b830e45ae2b15da9533867812@oracle.com> (raw)

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
 libdtrace/dt_prov_uprobe.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libdtrace/dt_prov_uprobe.c b/libdtrace/dt_prov_uprobe.c
index e575b0724..0e0f6a560 100644
--- a/libdtrace/dt_prov_uprobe.c
+++ b/libdtrace/dt_prov_uprobe.c
@@ -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,
 };
 
 /*
-- 
2.53.0


             reply	other threads:[~2026-04-28 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 19:05 Kris Van Hees [this message]
2026-04-28 20:54 ` [PATCH 6/6] uprobe: fix memory leak Nick Alcock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba06591b830e45ae2b15da9533867812@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox