From: Kris Van Hees <kris.van.hees@oracle.com>
To: Eugene Loh <eugene.loh@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [DTrace-devel] [PATCH] Fix memory leaks
Date: Thu, 21 Nov 2024 13:17:29 -0500 [thread overview]
Message-ID: <Zz95ORuCZkzpGQlz@oracle.com> (raw)
In-Reply-To: <ea997f1c-1ccc-cce7-d867-e19109bbcf46@oracle.com>
On Thu, Nov 21, 2024 at 01:10:29PM -0500, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
>
> (Oops by me.)
>
> I don't have a good feel for these things, but in dtrace_close() might it
> make more sense to move the free(dt_stmts) to right after the
> dt_program_destroy() loop?
Sure. Sounds like a good idea.
> With this patch, it also makes sense to remove the "CPC will call
> pfm_terminate()" comment in dtrace_close()
Ah yes, I overlooked that one. Thanks!
> On 11/21/24 01:40, Kris Van Hees wrote:
> > The array of statements was never freed.
> > The PFM library data was never cleaned up.
> >
> > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> > ---
> > libdtrace/dt_open.c | 2 ++
> > libdtrace/dt_prov_cpc.c | 1 +
> > 2 files changed, 3 insertions(+)
> >
> > diff --git a/libdtrace/dt_open.c b/libdtrace/dt_open.c
> > index e1972aa8..717a7ad0 100644
> > --- a/libdtrace/dt_open.c
> > +++ b/libdtrace/dt_open.c
> > @@ -1314,6 +1314,8 @@ dtrace_close(dtrace_hdl_t *dtp)
> > free(dirp);
> > }
> > + free(dtp->dt_stmts);
> > +
> > free(dtp->dt_cpp_argv);
> > free(dtp->dt_cpp_path);
> > free(dtp->dt_ld_path);
> > diff --git a/libdtrace/dt_prov_cpc.c b/libdtrace/dt_prov_cpc.c
> > index 8f33cf58..57b11b13 100644
> > --- a/libdtrace/dt_prov_cpc.c
> > +++ b/libdtrace/dt_prov_cpc.c
> > @@ -484,6 +484,7 @@ static void destroy(dtrace_hdl_t *dtp, void *arg)
> > dt_free(dtp, probe_map);
> > }
> > dt_free(dtp, arg);
> > + pfm_terminate();
> > }
> > dt_provimpl_t dt_cpc = {
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
prev parent reply other threads:[~2024-11-21 18:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 6:40 [PATCH] Fix memory leaks Kris Van Hees
2024-11-21 18:10 ` Eugene Loh
2024-11-21 18:17 ` Kris Van Hees [this message]
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=Zz95ORuCZkzpGQlz@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
--cc=eugene.loh@oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.