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/ecb6b1b87651
branches: trunk
changeset: 820481:ecb6b1b87651
user: christos <christos%NetBSD.org@localhost>
date: Tue Jan 10 15:34:49 2017 +0000
description:
PR/51815: Ngie Cooper: don't leak dlopen'ed handle
diffstat:
tests/lib/libc/string/t_strchr.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (40 lines):
diff -r 2c8d499a7fd8 -r ecb6b1b87651 tests/lib/libc/string/t_strchr.c
--- a/tests/lib/libc/string/t_strchr.c Tue Jan 10 15:33:40 2017 +0000
+++ b/tests/lib/libc/string/t_strchr.c Tue Jan 10 15:34:49 2017 +0000
@@ -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@localhost>
@@ -58,9 +58,10 @@
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 @@
"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 @@
verify_strchr(buf + a, 0xff, t, a);
}
}
+ (void)dlclose(dl_handle);
}
ATF_TP_ADD_TCS(tp)
Home |
Main Index |
Thread Index |
Old Index