Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/string PR/51815: Ngie Cooper: don't leak dlop...
details: https://anonhg.NetBSD.org/src/rev/747a837a0ae1
branches: trunk
changeset: 350622:747a837a0ae1
user: christos <christos%NetBSD.org@localhost>
date: Sat Jan 14 20:49:24 2017 +0000
description:
PR/51815: Ngie Cooper: don't leak dlopen'ed handle
diffstat:
tests/lib/libc/string/t_strlen.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r 97379bbe08c5 -r 747a837a0ae1 tests/lib/libc/string/t_strlen.c
--- a/tests/lib/libc/string/t_strlen.c Sat Jan 14 20:47:41 2017 +0000
+++ b/tests/lib/libc/string/t_strlen.c Sat Jan 14 20:49:24 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strlen.c,v 1.5 2011/07/14 07:33:20 jruoho Exp $ */
+/* $NetBSD: t_strlen.c,v 1.6 2017/01/14 20:49:24 christos Exp $ */
/*
* Written by J.T. Conklin <jtc%acorntoolworks.com@localhost>
@@ -40,6 +40,7 @@
ATF_TC_BODY(strlen_basic, tc)
{
+ void *dl_handle;
/* try to trick the compiler */
size_t (*strlen_fn)(const char *);
@@ -107,7 +108,8 @@
* During testing it is useful have the rest of the program
* use a known good version!
*/
- strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen");
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ strlen_fn = dlsym(dl_handle, "test_strlen");
if (!strlen_fn)
strlen_fn = strlen;
@@ -134,6 +136,7 @@
}
}
}
+ (void)dlclose(dl_handle);
}
ATF_TC(strlen_huge);
Home |
Main Index |
Thread Index |
Old Index