*new* memset: check for memset(x, y, 0); typos
[smatch.git] / validation / sm_double_free2.c
blob8ca7550bcc0cb20d59141d9bf26a312886fdc96d
1 #include <stdlib.h>
3 struct ture {
4 int a;
5 };
7 void func (void)
9 void *x;
11 x = malloc(sizeof(struct ture));
12 x->a = 1;
14 if (x->a)
15 free(x);
17 free(x);
19 return 0;
22 * check-name: double free test #2
23 * check-command: smatch sm_double_free2.c
25 * check-output-start
26 sm_double_free2.c +17 func(10) error: double free of 'x'
27 * check-output-end