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]
Message-ID: <54481503-67c6-40ec-a02a-31f4db4205f7@intel.com>
Date:   Thu, 12 Oct 2023 08:02:45 +0300
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     "Kunwu.Chan" <chentao@...inos.cn>, peterz@...radead.org,
        mingo@...hat.com, acme@...nel.org, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
        namhyung@...nel.org, irogers@...gle.com, kan.liang@...ux.intel.com,
        seanjc@...gle.com, kprateek.nayak@....com, robert.richter@....com
Cc:     linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        kunwu.chan@...mail.com
Subject: Re: [PATCH] perf tools: Put the function return operation at the end
 of the function

On 12/10/23 06:10, Kunwu.Chan wrote:
> Function return operations should be performed after resource release.
> 
> Fixes: 4e1b9c679fcb ("perf tools: Refactor print_event_desc()")
> Signed-off-by: Kunwu.Chan <chentao@...inos.cn>
> ---
>  tools/perf/util/header.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index d812e1e371a7..5763f21844b1 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -1998,13 +1998,14 @@ static struct evsel *read_event_desc(struct feat_fd *ff)
>  			id++;
>  		}
>  	}
> -out:
> -	free(buf);
> -	return events;
> +
>  error:
>  	free_event_desc(events);
>  	events = NULL;

Always freeing the events is wrong.  That path is only for errors.

That would show up if this had been tested.

> -	goto out;
> +
> +out:
> +	free(buf);
> +	return events;
>  }
>  
>  static int __desc_attr__fprintf(FILE *fp, const char *name, const char *val,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ