Commit-ID:  b2c34fde048f3c85ef0716a8cdabbe46ac67d1e6
Gitweb:     http://git.kernel.org/tip/b2c34fde048f3c85ef0716a8cdabbe46ac67d1e6
Author:     Adrian Hunter <adrian.hun...@intel.com>
AuthorDate: Thu, 4 Jul 2013 16:20:23 +0300
Committer:  Arnaldo Carvalho de Melo <a...@redhat.com>
CommitDate: Mon, 8 Jul 2013 17:45:41 -0300

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 <adrian.hun...@intel.com>
Acked-by: Jiri Olsa <jo...@redhat.com>
Cc: David Ahern <dsah...@gmail.com>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Mike Galbraith <efa...@gmx.de>
Cc: Namhyung Kim <namhy...@gmail.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Stephane Eranian <eran...@google.com>
Link: 
http://lkml.kernel.org/r/1372944040-32690-5-git-send-email-adrian.hun...@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
---
 tools/perf/util/parse-events.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 6c8bb0f..d8dcb8d 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;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to