Skip to content

Commit 92717bc

Browse files
james-c-linaronamhyung
authored andcommitted
perf dso: Fix build when libunwind is enabled
Now that symsrc_filename is always accessed through an accessor, we also need a free() function for it to avoid the following compilation error: util/unwind-libunwind-local.c:416:12: error: lvalue required as unary ‘&’ operand 416 | zfree(&dso__symsrc_filename(dso)); Fixes: 1553419 ("perf dso: Fix address sanitizer build") Signed-off-by: James Clark <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Tested-by: Leo Yan <[email protected]> Tested-by: Florian Fainelli <[email protected]> Cc: Yunseong Kim <[email protected]> Cc: Athira Rajeev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 2085948 commit 92717bc

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

tools/perf/util/dso.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ void dso__delete(struct dso *dso)
15011501
auxtrace_cache__free(RC_CHK_ACCESS(dso)->auxtrace_cache);
15021502
dso_cache__free(dso);
15031503
dso__free_a2l(dso);
1504-
zfree(&RC_CHK_ACCESS(dso)->symsrc_filename);
1504+
dso__free_symsrc_filename(dso);
15051505
nsinfo__zput(RC_CHK_ACCESS(dso)->nsinfo);
15061506
mutex_destroy(dso__lock(dso));
15071507
RC_CHK_FREE(dso);

tools/perf/util/dso.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,11 @@ static inline void dso__set_symsrc_filename(struct dso *dso, char *val)
602602
RC_CHK_ACCESS(dso)->symsrc_filename = val;
603603
}
604604

605+
static inline void dso__free_symsrc_filename(struct dso *dso)
606+
{
607+
zfree(&RC_CHK_ACCESS(dso)->symsrc_filename);
608+
}
609+
605610
static inline enum dso_binary_type dso__symtab_type(const struct dso *dso)
606611
{
607612
return RC_CHK_ACCESS(dso)->symtab_type;

tools/perf/util/unwind-libunwind-local.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
413413
__func__,
414414
dso__symsrc_filename(dso),
415415
debuglink);
416-
zfree(&dso__symsrc_filename(dso));
416+
dso__free_symsrc_filename(dso);
417417
}
418418
dso__set_symsrc_filename(dso, debuglink);
419419
} else {

0 commit comments

Comments
 (0)