mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
perf unwind: Handle allocation failure in libdw__get_entries()
Check the return value of zalloc() before dereferencing the allocated dwfl_ui_ti structure. Return -ENOMEM when the allocation fails to avoid a NULL pointer dereference. Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
024b219744
commit
aa18964dd6
|
|
@ -397,6 +397,11 @@ int libdw__get_entries(unwind_entry_cb_t cb, void *arg,
|
|||
dwfl = dwfl_ui_ti->dwfl;
|
||||
} else {
|
||||
dwfl_ui_ti = zalloc(sizeof(*dwfl_ui_ti));
|
||||
if (!dwfl_ui_ti) {
|
||||
free(ui);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dwfl = dwfl_begin(&offline_callbacks);
|
||||
if (!dwfl)
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user