getpwent_r(3) needs gr->gr_mem to be freed, but that's not documented

Cristian Rodríguez cristian@rodriguez.im
Sun Sep 28 21:23:31 GMT 2025


On Sun, Sep 28, 2025 at 5:40 PM Alejandro Colomar <alx@kernel.org> wrote:
>
> On Sun, Sep 28, 2025 at 10:26:33PM +0200, Alejandro Colomar wrote:
> > Hi!
> >
> > Another thing I realized about getpwent_r(3) et al. is that gr->gr_mem
>
> Actually, getgrent_r(3).
>
> > is allocated by the function, but is expected to be freed by the caller.
> >
> > I didn't find this documented, neither in the manual page nor in the
> > glibc manual.  Is it documented but I missed it?  Or did I misunderstand
> > something?  Or is it just that nobody documented it?

It is just not documented it seems, that's great..another footgun..


More information about the Libc-alpha mailing list