PR/51815: Ngie Cooper: don't leak dlopen'ed handle
This commit is contained in:
parent
149b98196c
commit
0480186ded
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue