File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1
- #include <assert.h>
2
1
#include <stdlib.h>
3
2
4
3
int main ()
5
4
{
6
- free () ;
7
- assert ( 0 );
5
+ int * ptr ;
6
+ free ( ptr );
8
7
return 0 ;
9
8
}
Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
main.c
3
- --pointer-check --bounds-check
4
- ^EXIT=0$
3
+ --pointer-check --bounds-check --stop-on-fail
4
+ free argument must be NULL or valid pointer
5
+ ^EXIT=10$
5
6
^SIGNAL=0$
6
- ^VERIFICATION SUCCESSFUL $
7
+ ^VERIFICATION FAILED $
7
8
--
8
9
^warning: ignoring
Original file line number Diff line number Diff line change 5
5
^SIGNAL=0$
6
6
^VERIFICATION FAILED$
7
7
free called for stack-allocated object: FAILURE$
8
- ^\*\* 1 of 12 failed
8
+ ^\*\* 1 of 13 failed
9
9
--
10
10
^warning: ignoring
Original file line number Diff line number Diff line change @@ -184,6 +184,9 @@ inline void free(void *ptr)
184
184
{
185
185
__CPROVER_HIDE :;
186
186
// If ptr is NULL, no operation is performed.
187
+ __CPROVER_precondition (
188
+ ptr == 0 || __CPROVER_r_ok (ptr , 0 ),
189
+ "free argument must be NULL or valid pointer" );
187
190
__CPROVER_precondition (ptr == 0 || __CPROVER_DYNAMIC_OBJECT (ptr ),
188
191
"free argument must be dynamic object" );
189
192
__CPROVER_precondition (ptr == 0 || __CPROVER_POINTER_OFFSET (ptr )== 0 ,
You can’t perform that action at this time.
0 commit comments