1 /* Test reporting of memory leaks in objects that have been dlopen'ed.
2 * File: dlclose_leak.c */
9 int (*jmp_on_uninit
)(void);
10 char* (*alloc_1_byte
)(void);
12 int main(int argc
, char** argv
)
14 int i
; for (i
= 0; i
< 2; ++i
)
17 char x
__attribute__((unused
));
18 void* handle
= dlopen("./dlclose_leak_so.so", RTLD_NOW
);
20 printf("FAILURE to dlopen dlclose_leak_so.so\n");
23 jmp_on_uninit
= dlsym(handle
,"jmp_on_uninit");
24 //fprintf(stderr, "jmp_on_uninit: %p\n", jmp_on_uninit);
25 assert(jmp_on_uninit
);
26 alloc_1_byte
= dlsym(handle
,"alloc_1_byte");
27 //fprintf(stderr, "alloc_1_byte: %p\n", alloc_1_byte);
29 (void)jmp_on_uninit();
30 memToLeak
= alloc_1_byte();
34 fprintf(stderr
, "done!\n");
35 return (EXIT_SUCCESS
);