Home | History | Annotate | Download | only in scudo
      1 // RUN: %clang_scudo %s -o %t
      2 // RUN: %run %t 2>&1
      3 
      4 // Tests that a regular workflow of allocation, memory fill and free works as
      5 // intended. Also tests that a zero-sized allocation succeeds.
      6 
      7 #include <malloc.h>
      8 #include <stdlib.h>
      9 #include <string.h>
     10 
     11 int main(int argc, char **argv)
     12 {
     13   void *p;
     14   size_t size = 1U << 8;
     15 
     16   p = malloc(size);
     17   if (!p)
     18     return 1;
     19   memset(p, 'A', size);
     20   free(p);
     21   p = malloc(0);
     22   if (!p)
     23     return 1;
     24   free(p);
     25 
     26   return 0;
     27 }
     28