From: Namhyung Kim Date: Sat, 7 Jan 2012 17:25:29 +0000 (+0900) Subject: perf kmem: Fix a memory leak X-Git-Tag: firefly_0821_release~3680^2~3703^2~4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1b22859d4320d472a7a51ff4a43f62b0578469de;p=firefly-linux-kernel-4.4.55.git perf kmem: Fix a memory leak The 'str' should be freed when sort_dimension__add() failed too. Cc: Ingo Molnar Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1325957132-10600-5-git-send-email-namhyung@gmail.com Signed-off-by: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 7a9b5c55ad5a..39104c0beea3 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -647,6 +647,7 @@ static int setup_sorting(struct list_head *sort_list, const char *arg) break; if (sort_dimension__add(tok, sort_list) < 0) { error("Unknown --sort key: '%s'", tok); + free(str); return -1; } }