1 #include <stdlib.h>
   2 
   3 struct ture {
   4         int a;
   5 };
   6 
   7 void func (void)
   8 {
   9         void *x;
  10 
  11         x = malloc(sizeof(struct ture));
  12         x->a = 1;
  13 
  14         if (x->a)
  15                 free(x);
  16 
  17         free(x);
  18 
  19         return 0;
  20 }
  21 /*
  22  * check-name: double free test #2
  23  * check-command: smatch sm_double_free2.c
  24  *
  25  * check-output-start
  26 sm_double_free2.c:17 func() error: double free of 'x'
  27  * check-output-end
  28  */