File perf-local-check-alloc-histogram-return.patch of Package perf.35610
From: Tony Jones <tonyj@suse.de>
Subject: Detect memory allocation failure in annotated_source__alloc_histograms
References: bsc#1227962
Patch-mainline: no, fixed via alternate method upstream
Commit 8a07aa4e9b7b "perf report: Fix OOM error in TUI mode on s390"
checks the return code for symbol__hists() but inside this function
the success of annotated_source__alloc_histograms is never checked.
This has been fixed upstream somehow as a result of the patch series ending
with f59e3660cd84 "perf annotate: Remove sym_hist.addr[] array" so we will
maintain this as a local SUSE only patch.
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -944,8 +944,10 @@ struct annotated_source *symbol__hists(s
if (notes->src->histograms == NULL) {
alloc_histograms:
- annotated_source__alloc_histograms(notes->src, symbol__size(sym),
- nr_hists);
+ if (annotated_source__alloc_histograms(notes->src, symbol__size(sym),
+ nr_hists) == -1) {
+ return NULL;
+ }
}
return notes->src;