perf kmem: Fix a memory leak
authorNamhyung Kim <namhyung@gmail.com>
Sat, 7 Jan 2012 17:25:29 +0000 (02:25 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 8 Jan 2012 15:27:54 +0000 (13:27 -0200)
The 'str' should be freed when sort_dimension__add() failed too.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-5-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-kmem.c

index 7a9b5c5..39104c0 100644 (file)
@@ -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;
                }
        }