summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/srccode.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/srccode.c')
-rw-r--r--tools/perf/util/srccode.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/perf/util/srccode.c b/tools/perf/util/srccode.c
index 684b155c222a..adfcf1ff464c 100644
--- a/tools/perf/util/srccode.c
+++ b/tools/perf/util/srccode.c
@@ -4,7 +4,8 @@
* Copyright (c) 2017, Intel Corporation.
* Author: Andi Kleen
*/
-#include "linux/list.h"
+#include <linux/list.h>
+#include <linux/zalloc.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -82,12 +83,12 @@ static void fill_lines(char **lines, int maxline, char *map, int maplen)
static void free_srcfile(struct srcfile *sf)
{
- list_del(&sf->nd);
+ list_del_init(&sf->nd);
hlist_del(&sf->hash_nd);
map_total_sz -= sf->maplen;
munmap(sf->map, sf->maplen);
- free(sf->lines);
- free(sf->fn);
+ zfree(&sf->lines);
+ zfree(&sf->fn);
free(sf);
num_srcfiles--;
}
@@ -153,7 +154,7 @@ static struct srcfile *find_srcfile(char *fn)
out_map:
munmap(h->map, sz);
out_fn:
- free(h->fn);
+ zfree(&h->fn);
out_h:
free(h);
return NULL;