lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 6 Sep 2020 14:41:33 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Andi Kleen <andi@...stfloor.org>,
        Kajol Jain <kjain@...ux.ibm.com>,
        John Garry <john.garry@...wei.com>,
        Ian Rogers <irogers@...gle.com>
Subject: Re: [PATCH v2 2/2] perf metric: Fix some memory leaks - part 2

On Sat, Sep 05, 2020 at 11:19:12AM +0900, Namhyung Kim wrote:
> The metric_event_delete() missed to free expr->metric_events and it
> should free an expr when metric_refs allocation failed.
> 
> Cc: Kajol Jain <kjain@...ux.ibm.com>
> Cc: John Garry <john.garry@...wei.com>
> Cc: Ian Rogers <irogers@...gle.com>
> Fixes: 4ea2896715e67 ("perf metric: Collect referenced metrics in struct metric_expr")
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>

Acked-by: Jiri Olsa <jolsa@...hat.com>

thanks,
jirka

> ---
>  tools/perf/util/metricgroup.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index af664d6218d6..b28c09447c10 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -85,6 +85,7 @@ static void metric_event_delete(struct rblist *rblist __maybe_unused,
>  
>  	list_for_each_entry_safe(expr, tmp, &me->head, nd) {
>  		free(expr->metric_refs);
> +		free(expr->metric_events);
>  		free(expr);
>  	}
>  
> @@ -316,6 +317,7 @@ static int metricgroup__setup_events(struct list_head *groups,
>  			if (!metric_refs) {
>  				ret = -ENOMEM;
>  				free(metric_events);
> +				free(expr);
>  				break;
>  			}
>  
> -- 
> 2.28.0.526.ge36021eeef-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ