freebsd-dev/lib/libspl
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
..
include libspl: kmem.h: mark unused kmem_*() macro arguments used 2021-12-23 09:36:12 -08:00
os FreeBSD: Fix leaked strings in libspl mnttab 2022-01-14 12:38:32 -08:00
assert.c libspl: staticify buf and pagesize, rename aok to libspl_assert_ok 2021-06-03 11:04:13 -06:00
atomic.c More aggsum optimizations 2021-06-07 09:02:47 -07:00
getexecname.c libspl: lift common bits of getexecname() 2021-04-15 14:55:40 -07:00
libspl_impl.h libspl: lift common bits of getexecname() 2021-04-15 14:55:40 -07:00
list.c Fixing gang ABD child removal race condition 2020-07-14 11:04:35 -07:00
Makefile.am libspl: implement atomics in terms of atomics 2021-04-18 22:13:24 -07:00
mkdirp.c Fix typos in lib/ 2019-09-02 17:53:27 -07:00
page.c libspl: fix warning about missing spl_pagesize declaration 2021-09-24 16:59:26 -06:00
strlcat.c Check for strlcat and strlcpy 2018-12-11 16:01:41 -08:00
strlcpy.c Check for strlcat and strlcpy 2018-12-11 16:01:41 -08:00
timestamp.c Always use "%lld" for formatting time_ts 2020-05-28 10:29:58 -07:00