[PATCH] do not free string returned by login_getcapstr

Darren Tucker dtucker at dtucker.net
Tue Feb 16 10:19:22 AEDT 2021


On Tue, 16 Feb 2021 at 05:49, Ed Maste <emaste at freebsd.org> wrote:
> From the login_getcapstr man page,
> > Note that with all functions in this group, you should not call free(3)
> > on any pointers returned.  Memory allocated during retrieval or
> > processing of capability tags is automatically reused by subsequent calls
> > to functions in this group, or deallocated on calling login_close().

That seems to be a difference between FreeBSD and OpenBSD, since the
latter says:

CAVEATS
     The string returned by login_getcapstr() is allocated via malloc(3) when
     the specified capability is present and thus it is the responsibility of
     the caller to free() this space.

-- 
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA (new)
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list