File tree Expand file tree Collapse file tree 4 files changed +38
-0
lines changed
regression/cbmc/Memory_leak_abort Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdlib.h>
2
+
3
+ extern void __VERIFIER_error () __attribute__ ((__noreturn__ ));
4
+
5
+ int main ()
6
+ {
7
+ int * p = malloc (sizeof (int ));
8
+ if (* p == 0 )
9
+ abort ();
10
+ if (* p == 1 )
11
+ exit (1 );
12
+ if (* p == 2 )
13
+ _Exit (1 );
14
+ free (p );
15
+ return 0 ;
16
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --memory-leak-check
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ _Exit\.memory-leak\.1.*FAILURE
8
+ __CPROVER__start\.memory-leak\.1.*SUCCESS
9
+ abort\.memory-leak\.1.*FAILURE
10
+ exit\.memory-leak\.1.*FAILURE
11
+ --
12
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ rm Malloc23/test.desc
53
53
rm Malloc24/test.desc
54
54
rm Memory_leak1/test.desc
55
55
rm Memory_leak2/test.desc
56
+ rm Memory_leak_abort/test.desc
56
57
rm Multi_Dimensional_Array1/test.desc
57
58
rm Multi_Dimensional_Array2/test.desc
58
59
rm Multi_Dimensional_Array3/test.desc
Original file line number Diff line number Diff line change @@ -1703,6 +1703,15 @@ void goto_checkt::goto_check(
1703
1703
}
1704
1704
else if (i.is_assume ())
1705
1705
{
1706
+ // These are further 'exit points' of the program
1707
+ const exprt simplified_guard = simplify_expr (i.guard , ns);
1708
+ if (
1709
+ enable_memory_leak_check && simplified_guard.is_false () &&
1710
+ (i.function == " abort" || i.function == " exit" ||
1711
+ i.function == " _Exit" ))
1712
+ {
1713
+ memory_leak_check (i.function );
1714
+ }
1706
1715
if (!enable_assumptions)
1707
1716
{
1708
1717
i.make_skip ();
You can’t perform that action at this time.
0 commit comments