19 * check_memory() is getting too big and messy.
20 *
21 */
22
23 #include <string.h>
24 #include "smatch.h"
25 #include "smatch_slist.h"
26 #include "smatch_extra.h"
27
28 static int my_id;
29
30 STATE(freed);
31 STATE(ok);
32
33 static void ok_to_use(struct sm_state *sm, struct expression *mod_expr)
34 {
35 if (sm->state != &ok)
36 set_state(my_id, sm->name, sm->sym, &ok);
37 }
38
39 static void pre_merge_hook(struct sm_state *sm)
40 {
41 if (is_impossible_path())
42 set_state(my_id, sm->name, sm->sym, &ok);
43 }
44
45 static int is_freed(struct expression *expr)
46 {
47 struct sm_state *sm;
48
49 sm = get_sm_state_expr(my_id, expr);
50 if (sm && slist_has_state(sm->possible, &freed))
51 return 1;
52 return 0;
53 }
54
55 static void match_symbol(struct expression *expr)
56 {
57 struct expression *parent;
58 char *name;
59
60 if (is_impossible_path())
61 return;
62 if (__in_fake_parameter_assign)
|
19 * check_memory() is getting too big and messy.
20 *
21 */
22
23 #include <string.h>
24 #include "smatch.h"
25 #include "smatch_slist.h"
26 #include "smatch_extra.h"
27
28 static int my_id;
29
30 STATE(freed);
31 STATE(ok);
32
33 static void ok_to_use(struct sm_state *sm, struct expression *mod_expr)
34 {
35 if (sm->state != &ok)
36 set_state(my_id, sm->name, sm->sym, &ok);
37 }
38
39 static void pre_merge_hook(struct sm_state *cur, struct sm_state *other)
40 {
41 if (is_impossible_path())
42 set_state(my_id, cur->name, cur->sym, &ok);
43 }
44
45 static int is_freed(struct expression *expr)
46 {
47 struct sm_state *sm;
48
49 sm = get_sm_state_expr(my_id, expr);
50 if (sm && slist_has_state(sm->possible, &freed))
51 return 1;
52 return 0;
53 }
54
55 static void match_symbol(struct expression *expr)
56 {
57 struct expression *parent;
58 char *name;
59
60 if (is_impossible_path())
61 return;
62 if (__in_fake_parameter_assign)
|