From 046625231a0397f1776eb353a4ec9ff142cd2f6b Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 26 Dec 2013 17:41:15 -0300 Subject: perf tools: Introduce zfree For the frequent idiom of: free(ptr); ptr = NULL; Make it expect a pointer to the pointer being freed, so that it becomes clear at first sight that the variable being freed is being modified. Cc: Adrian Hunter Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-pfw02ezuab37kha18wlut7ir@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/help.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tools/perf/util/help.c') diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c index 8b1f6e8..7b68978 100644 --- a/tools/perf/util/help.c +++ b/tools/perf/util/help.c @@ -263,9 +263,8 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) for (i = 0; i < old->cnt; i++) cmds->names[cmds->cnt++] = old->names[i]; - free(old->names); + zfree(&old->names); old->cnt = 0; - old->names = NULL; } const char *help_unknown_cmd(const char *cmd) -- cgit v1.1