perf tests: Fixup leak on error path in parse events test
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 3 Jan 2014 20:30:04 +0000 (17:30 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Jan 2014 13:06:22 +0000 (10:06 -0300)
We need to call the evlist destructor when failing to parse events.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ilslu69s7v7bpvdgqtrlp8f5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/parse-events.c

index e4ce8aed29d3bee8aab8e17648bc155475ef348c..41dee5e67f630126d57619fd04d754ff7dc63e2c 100644 (file)
@@ -1385,10 +1385,10 @@ static int test_event(struct evlist_test *e)
        if (ret) {
                pr_debug("failed to parse event '%s', err %d\n",
                         e->name, ret);
-               return ret;
+       } else {
+               ret = e->check(evlist);
        }
-
-       ret = e->check(evlist);
+       
        perf_evlist__delete(evlist);
 
        return ret;