[DTrace-devel] [PATCH] Fix memory leak
Kris Van Hees
kris.van.hees at oracle.com
Wed Jun 3 19:18:12 PDT 2020
See my patch posted on May 29th, 2020:
[PATCH 01/15 v2] Fix various memory leaks
You will see that the allocation is now alloca() which means a free is
no longer necessary here.
On Wed, Jun 03, 2020 at 04:54:43PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> In c333e1c0eb57371f8227dd7491ef085e95bff051
> ("Convert dtrace_probedesc_t to the new form (with char * members)."),
> statically sized character arrays in dtrace_probedesc_t used for
> module, function, and probe names were replaced with character strings.
> As a result, a local, fixed-size array was replace with a dynamically
> allocated array.
>
> Free the allocated array after its use.
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
> cmd/dtrace.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/cmd/dtrace.c b/cmd/dtrace.c
> index 3dc49800..f9f7a08d 100644
> --- a/cmd/dtrace.c
> +++ b/cmd/dtrace.c
> @@ -771,6 +771,8 @@ chew(const dtrace_probedata_t *data, void *arg)
> oprintf("%3d %6d %32s ", cpu, pd->id, name);
> else
> oprintf("%32s ", name);
> +
> + free(name);
> }
> } else {
> int indent = data->dtpda_indent;
> --
> 2.18.2
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list