]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/perf/builtin-kmem.c
perf kmem: Fix a memory leak
[karo-tx-linux.git] / tools / perf / builtin-kmem.c
index 886174e9525b5e275be2dd9c16b6385c0c800f8c..39104c0beea37990bd1775c0592179dda9a57140 100644 (file)
@@ -19,7 +19,7 @@
 struct alloc_stat;
 typedef int (*sort_fn_t)(struct alloc_stat *, struct alloc_stat *);
 
-static char const              *input_name = "perf.data";
+static const char              *input_name;
 
 static int                     alloc_flag;
 static int                     caller_flag;
@@ -108,7 +108,9 @@ static void setup_cpunode_map(void)
                                continue;
                        cpunode_map[cpu] = mem;
                }
+               closedir(dir2);
        }
+       closedir(dir1);
 }
 
 static void insert_alloc_stat(unsigned long call_site, unsigned long ptr,
@@ -645,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;
                }
        }