Module Name: src
Committed By: christos
Date: Tue Jan 10 15:34:49 UTC 2017
Modified Files:
src/tests/lib/libc/string: t_strchr.c
Log Message:
PR/51815: Ngie Cooper: don't leak dlopen'ed handle
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/string/t_strchr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/string/t_strchr.c
diff -u src/tests/lib/libc/string/t_strchr.c:1.1 src/tests/lib/libc/string/t_strchr.c:1.2
--- src/tests/lib/libc/string/t_strchr.c:1.1 Thu Jul 7 04:59:33 2011
+++ src/tests/lib/libc/string/t_strchr.c Tue Jan 10 10:34:49 2017
@@ -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 <[email protected]>
@@ -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)