On Thu, 12 Dec 2024, James K. Lowden wrote:
> + switch(e->type) {
> + case SymFilename:
> + asprintf(&s, "%4zu %-18s %s", e->program,
> + "Filename", e->elem.filename);
> + break;
You need to check for errors from allocation functions such as asprintf
before using the results. In some places you're checking, but not here.
I stringly advise using xasprintf from libiberty everywhere you're
currently using asprintf, to avoid needing to hardcode checks at each call
site.
--
Joseph S. Myers
[email protected]