diff options
| author | christos <christos@NetBSD.org> | 2017-01-10 15:34:49 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2017-01-10 15:34:49 +0000 |
| commit | 055dbb0ed4e270d1fa96d02dfc17d70f229d5090 (patch) | |
| tree | fc09be66f46d9de76709d4c41fa47fe1e1bac788 /tests/lib/libc/string | |
| parent | db051e4d21c66f0884e87218e90b34af067a0ffa (diff) | |
PR/51815: Ngie Cooper: don't leak dlopen'ed handle
Diffstat (limited to 'tests/lib/libc/string')
| -rw-r--r-- | tests/lib/libc/string/t_strchr.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/lib/libc/string/t_strchr.c b/tests/lib/libc/string/t_strchr.c index 958b186e9ce..5dd9a62213a 100644 --- a/tests/lib/libc/string/t_strchr.c +++ b/tests/lib/libc/string/t_strchr.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_strchr.c,v 1.1 2011/07/07 08:59:33 jruoho Exp $ */ +/* $NetBSD: t_strchr.c,v 1.2 2017/01/10 15:34:49 christos Exp $ */ /* * Written by J.T. Conklin <jtc@acorntoolworks.com> @@ -58,9 +58,10 @@ ATF_TC_HEAD(strchr_basic, tc) ATF_TC_BODY(strchr_basic, tc) { - unsigned int t, a; + void *dl_handle; char *off; char buf[32]; + unsigned int t, a; const char *tab[] = { "", @@ -245,8 +246,8 @@ ATF_TC_BODY(strchr_basic, tc) "abcdefgh/abcdefgh/", }; - - strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr"); + dl_handle = dlopen(NULL, RTLD_LAZY); + strchr_fn = dlsym(dl_handle, "test_strlen"); if (!strchr_fn) strchr_fn = strchr; @@ -281,6 +282,7 @@ ATF_TC_BODY(strchr_basic, tc) verify_strchr(buf + a, 0xff, t, a); } } + (void)dlclose(dl_handle); } ATF_TP_ADD_TCS(tp) |
