zfs/lib/libspl/os/freebsd
Ryan Moeller 69c5e694a1
FreeBSD: Fix leaked strings in libspl mnttab
The FreeBSD implementations of various libspl functions for getting
mounted device information were found to leak several strings which
were being allocated in statfs2mnttab but never freed.

The Solaris getmntany(3C) and related interfaces are expected to return
strings residing in static buffers that need to be copied rather than
freed by the caller.

Use static thread-local storage to stash the mnttab structure strings
from FreeBSD's statfs info rather than strings allocated on the heap by
strdup(3).

While here, remove some stray commented out lines.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #12961
2022-01-14 12:38:32 -08:00
..
getexecname.c libspl: lift common bits of getexecname() 2021-04-15 14:55:40 -07:00
gethostid.c Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00
getmntany.c FreeBSD: Improve libzfs_error_init messages 2020-10-13 09:38:40 -07:00
mnttab.c FreeBSD: Fix leaked strings in libspl mnttab 2022-01-14 12:38:32 -08:00
zone.c libspl: Provide platform-specific zone implementations 2020-08-31 19:43:30 -07:00