We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f443b18 commit 3a4ebebCopy full SHA for 3a4ebeb
src/ansi-c/library/stdlib.c
@@ -145,14 +145,13 @@ inline void free(void *ptr)
145
{
146
__CPROVER_HIDE:;
147
// If ptr is NULL, no operation is performed.
148
+ __CPROVER_precondition(ptr==0 || __CPROVER_DYNAMIC_OBJECT(ptr),
149
+ "free argument must be dynamic object");
150
+ __CPROVER_precondition(ptr==0 || __CPROVER_POINTER_OFFSET(ptr)==0,
151
+ "free argument has offset zero");
152
+
153
if(ptr!=0)
154
- // is it dynamic?
- __CPROVER_assert(__CPROVER_DYNAMIC_OBJECT(ptr),
- "free argument is dynamic object");
- __CPROVER_assert(__CPROVER_POINTER_OFFSET(ptr)==0,
- "free argument has offset zero");
155
-
156
// catch double free
157
if(__CPROVER_deallocated==ptr)
158
__CPROVER_assert(0, "double free");
0 commit comments