From: Adrian Hunter Date: Thu, 4 Jul 2013 13:20:23 +0000 (+0300) Subject: perf tools: Fix parse_events_terms() segfault on error path X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=b2c34fde048f3c85ef0716a8cdabbe46ac67d1e6;p=openwrt%2Fstaging%2Fblogic.git perf tools: Fix parse_events_terms() segfault on error path On the error path, 'data.terms' may not have been initialised. Signed-off-by: Adrian Hunter Acked-by: Jiri Olsa Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1372944040-32690-5-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 6c8bb0fb189b..d8dcb8dbb1e2 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -860,7 +860,8 @@ int parse_events_terms(struct list_head *terms, const char *str) return 0; } - parse_events__free_terms(data.terms); + if (data.terms) + parse_events__free_terms(data.terms); return ret; }