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:	Thu, 9 Jun 2016 10:37:38 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Taeung Song <treeze.taeung@...il.com>
Cc:	linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Wang Nan <wangnan0@...wei.com>, Jiri Olsa <jolsa@...hat.com>
Subject: Re: [PATCH v8 4/5] perf config: Use zfree() instead of free() at
 perf_config_set__delete()

Em Wed, Jun 08, 2016 at 09:36:52PM +0900, Taeung Song escreveu:
> perf_config_set__delete() delete allocated the config set
> but the global variable 'config_set' is used all around.
 
> So purge and zfree by an address of the global variable
> , i.e. 'struct perf_config_set **' type
> instead of using local variable 'set' of which type
> is 'struct perf_config_set *'.

> -void perf_config_set__delete(struct perf_config_set *set)
> +void perf_config_set__delete(struct perf_config_set **set)
>  {
> -	if (set == NULL)
> +	if (*set == NULL)
>  		return;
>  
> -	perf_config_set__purge(set);
> -	free(set);
> +	perf_config_set__purge(*set);
> +	zfree(set);
>  }

Nope, don't change conventions like taht, a delete method should not
receive a pointer to the pointer to be deleted, no odd cases, please.

If you really think this is interesting, please introduce zdelete(),
i.e.:

void perf_config_set__zdelete(struct perf_config_set **set)
{
	if (!set)
		return;

	perf_config_set__delete(*set);
	*set = NULL;
}

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ