[PATCH v2 2/3] perf symbol: Add missing symsrc__destroy() for libbfd
From: Namhyung Kim
Date: Sat Oct 10 2026 - 14:25:04 EST
When libbfd loaded symbols and there's a pending syms_ss, it'd be lost
or overwrite existing symbols. Let's destroy it before breaking the
loop so that it can safely return from the function.
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/r/sashiko-outbox-162540@xxxxxxxxxx
Fixes: eac9a4342e5447cad ("perf symbols: Try reading the symbol table with libbfd")
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/symbol.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index a394e742f9b18812..93045123cbbefdbd 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1931,6 +1931,10 @@ int dso__load(struct dso *dso, struct map *map)
nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
if (bfdrc > 0) {
+ if (syms_ss) {
+ symsrc__destroy(syms_ss);
+ syms_ss = NULL;
+ }
ret = 1;
break;
}
--
2.55.0