[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180810070404.GD479@sejong>
Date: Fri, 10 Aug 2018 16:04:04 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Tom Zanussi <zanussi@...nel.org>
Cc: rostedt@...dmis.org, tglx@...utronix.de, mhiramat@...nel.org,
vedang.patel@...el.com, bigeasy@...utronix.de,
joel@...lfernandes.org, mathieu.desnoyers@...icios.com,
julia@...com, linux-kernel@...r.kernel.org,
linux-rt-users@...r.kernel.org, kernel-team@....com
Subject: Re: [PATCH v3 6/7] tracing: Add snapshot action
On Thu, Aug 09, 2018 at 09:34:16AM -0500, Tom Zanussi wrote:
> From: Tom Zanussi <tom.zanussi@...ux.intel.com>
>
> Add support for hist:handlerXXX($var).snapshot(), which will take a
> snapshot of the current trace buffer whenever handlerXXX is hit.
>
> As a first user, this also adds snapshot() action support for the
> onmax() handler i.e. hist:onmax($var).snapshot().
>
> Signed-off-by: Tom Zanussi <tom.zanussi@...ux.intel.com>
> ---
[SNIP]
> +static struct track_data *track_data_alloc(unsigned int key_len,
> + struct action_data *action_data,
> + struct hist_trigger_data *hist_data)
> +{
> + struct track_data *data = kzalloc(sizeof(*data), GFP_KERNEL);
> + unsigned int size = TASK_COMM_LEN;
> + struct hist_elt_data *elt_data;
> +
> + if (!data)
> + return ERR_PTR(-ENOMEM);
> +
> + data->key = kzalloc(key_len, GFP_KERNEL);
> + if (!data->key) {
> + track_data_free(data);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + data->key_len = key_len;
> + data->action_data = action_data;
> + data->hist_data = hist_data;
> +
> + elt_data = kzalloc(sizeof(*elt_data), GFP_KERNEL);
> + if (!elt_data) {
> + track_data_free(data);
> + return ERR_PTR(-ENOMEM);
> + }
> + elt_data->comm = kzalloc(size, GFP_KERNEL);
> + if (!elt_data->comm) {
> + track_data_free(data);
It seems to leak 'elf_data' here.
Thanks,
Namhyung
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + data->elt.private_data = elt_data;
> +
> + return data;
> +}
Powered by blists - more mailing lists