diff options
author | Yunseong Kim <[email protected]> | 2024-06-20 05:42:12 +0900 |
---|---|---|
committer | Namhyung Kim <[email protected]> | 2024-06-25 11:06:20 -0700 |
commit | 83da316a3bb6de327a070471584be4a0165bee7f (patch) | |
tree | a6d02d8da23adc1bf765c4f9f03475a11ff84707 | |
parent | e9ffa312ff06cde77c4a6395c411c5ebde738f04 (diff) |
perf unwind-libunwind: Add malloc() failure handling
Add malloc() failure handling in unread_unwind_spec_debug_frame().
This make caller find_proc_info() works well when the allocation failure.
Signed-off-by: Yunseong Kim <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: Austin Kim <[email protected]>
Cc: [email protected]
Cc: Ze Gao <[email protected]>
Cc: Leo Yan <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
-rw-r--r-- | tools/perf/util/unwind-libunwind-local.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c index cde267ea3e99..a424eae6d308 100644 --- a/tools/perf/util/unwind-libunwind-local.c +++ b/tools/perf/util/unwind-libunwind-local.c @@ -390,6 +390,11 @@ static int read_unwind_spec_debug_frame(struct dso *dso, char *debuglink = malloc(PATH_MAX); int ret = 0; + if (debuglink == NULL) { + pr_err("unwind: Can't read unwind spec debug frame.\n"); + return -ENOMEM; + } + ret = dso__read_binary_type_filename( dso, DSO_BINARY_TYPE__DEBUGLINK, machine->root_dir, debuglink, PATH_MAX); |