perf tools: Use list_del_init() more thorougly
To allow for destructors to check if they're operating on a object still in a list, and to avoid going from use after free list entries into still valid, or even also other already removed from list entries. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-deh17ub44atyox3j90e6rksu@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -83,7 +83,7 @@ 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);
|
||||
|
Reference in New Issue
Block a user