diff options
author | ngie <ngie@FreeBSD.org> | 2017-01-07 09:17:45 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-01-07 09:17:45 +0000 |
commit | 067d2ed2b3eba75e7dfd986e119406cb3e472849 (patch) | |
tree | a82bc59e66d94ef0b0045c417f47989639ee047d /contrib/netbsd-tests/lib/libc/string/t_strchr.c | |
parent | 5dba8e8dc119241ee8d6222279c0da2ce10f9efe (diff) | |
download | FreeBSD-src-067d2ed2b3eba75e7dfd986e119406cb3e472849.zip FreeBSD-src-067d2ed2b3eba75e7dfd986e119406cb3e472849.tar.gz |
MFC r311249:
{strchr,strlen}_basic: don't leak the dlopen'ed handle; close after use
CID: 978299, 978300
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/string/t_strchr.c')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/string/t_strchr.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/netbsd-tests/lib/libc/string/t_strchr.c b/contrib/netbsd-tests/lib/libc/string/t_strchr.c index 958b186..4556b2c 100644 --- a/contrib/netbsd-tests/lib/libc/string/t_strchr.c +++ b/contrib/netbsd-tests/lib/libc/string/t_strchr.c @@ -58,6 +58,9 @@ ATF_TC_HEAD(strchr_basic, tc) ATF_TC_BODY(strchr_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif unsigned int t, a; char *off; char buf[32]; @@ -245,8 +248,12 @@ ATF_TC_BODY(strchr_basic, tc) "abcdefgh/abcdefgh/", }; - +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strchr_fn = dlsym(dl_handle, "test_strlen"); +#else strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr"); +#endif if (!strchr_fn) strchr_fn = strchr; @@ -281,6 +288,9 @@ ATF_TC_BODY(strchr_basic, tc) verify_strchr(buf + a, 0xff, t, a); } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TP_ADD_TCS(tp) |