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:
@@ -1586,7 +1586,7 @@ static void delete_last_nop(struct symbol *sym)
|
||||
return;
|
||||
}
|
||||
|
||||
list_del(&dl->al.node);
|
||||
list_del_init(&dl->al.node);
|
||||
disasm_line__free(dl);
|
||||
}
|
||||
}
|
||||
@@ -2463,7 +2463,7 @@ void annotated_source__purge(struct annotated_source *as)
|
||||
struct annotation_line *al, *n;
|
||||
|
||||
list_for_each_entry_safe(al, n, &as->source, node) {
|
||||
list_del(&al->node);
|
||||
list_del_init(&al->node);
|
||||
disasm_line__free(disasm_line(al));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user