Back to index

glibc  2.9
tst-leaks1.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <dlfcn.h>
00003 #include <mcheck.h>
00004 #include <stdlib.h>
00005 
00006 int
00007 main (void)
00008 {
00009   mtrace ();
00010 
00011   int ret = 0;
00012   for (int i = 0; i < 10; i++)
00013     {
00014       void *h = dlopen (i < 5 ? "./tst-leaks1.c"
00015                            : "$ORIGIN/tst-leaks1.o", RTLD_LAZY);
00016       if (h != NULL)
00017        {
00018          puts ("dlopen unexpectedly succeeded");
00019          ret = 1;
00020          dlclose (h);
00021        }
00022     }
00023 
00024   return ret;
00025 }