Re: fix a use-after-free bug

Collin Funk <[email protected]> Sun, 04 May 2025 11:03:29 -0700
Newsgroups gmane.comp.gnu.inetutils.bugs
Message-ID <[email protected]>
Hi Bruno,

Bruno Haible via Bug reports for the GNU Internet utilities
<[email protected]> writes:

> gcc 15 reports this warning from -Wanalyzer-use-after-free:
> ../../talkd/table.c:65:30: warning: use after 'free' of 'ptr' [CWE-416]
>
> gcc is right here: Accessing ptr->next after calling free (ptr)
> (inside table_delete (ptr)) is invalid.

I don't recall seeing this using -fanalyzer previously, so I assume
there were some improvements in GCC 15. Thanks for the patch.

Simon, this patch looks correct to me. Can you apply it? Not sure if it
needs to be marked '(tiny patch)' or not.

Thanks,
Collin