Current colllect_config() free a config set on failure. But it is needed to finally free it at perf_config_set__new() after collect_config() worked.
Cc: Namhyung Kim <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Alexander Shishkin <[email protected]> Signed-off-by: Taeung Song <[email protected]> --- tools/perf/util/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c index b500737..d013f90 100644 --- a/tools/perf/util/config.c +++ b/tools/perf/util/config.c @@ -639,7 +639,6 @@ static int collect_config(const char *var, const char *value, out_free: free(key); - perf_config_set__delete(set); return -1; } @@ -649,7 +648,8 @@ struct perf_config_set *perf_config_set__new(void) if (set) { INIT_LIST_HEAD(&set->sections); - perf_config(collect_config, set); + if (perf_config(collect_config, set) < 0) + perf_config_set__delete(set); } return set; -- 2.5.0

