Re: [PATCH v2 03/18] perf symbol: Add accessor functions for struct symbol fields
From: Alireza Haghdoost
Date: Fri Oct 30 2026 - 00:09:02 EST
On Tue, Oct 27, 2026 at 4:14 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> static void init_rem_hits(void)
> {
> - rem_sq_bracket = malloc(sizeof(*rem_sq_bracket) + 6);
> + rem_sq_bracket = symbol__new(0, 0, 0, 0, "[...]");
Doesn't this make hists__fprintf() pass an interior pointer to free()?
At this commit symbol__new() still returns calloc() +
symbol_conf.priv_size, but hists__fprintf() still frees rem_sq_bracket
with zfree(). Once symbol__annotation_init() has run, priv_size is not
zero and free() gets a pointer into the middle of the block.
Should we use symbol__delete(), which subtracts priv_size before freeing?