Home | History | Annotate | Download | only in tests
      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 
      4 /* Test that a program that has malloc/free interposed in the
      5    executable is also intercepted. */
      6 
      7 int main ( void )
      8 {
      9    printf ("start\n");
     10    void *p = malloc (1024);
     11    free (p);
     12    printf ("done\n");
     13    return 0;
     14 }
     15 
     16 /* Fake malloc/free functions that just print something. When run
     17    under memcheck these functions will be intercepted and not print
     18    anything. */
     19 
     20 void *malloc ( size_t size )
     21 {
     22   printf ("malloc\n");
     23   return NULL;
     24 }
     25 
     26 void free (void *ptr)
     27 {
     28   printf ("free\n");
     29 }
     30