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 94fb414 commit 390880eCopy full SHA for 390880e
src/ansi-c/library/stdlib.c
@@ -525,20 +525,13 @@ __CPROVER_HIDE:;
525
// As _mid_memalign simplifies for alignment <= MALLOC_ALIGNMENT
526
// to a malloc call, it should be sound, if we do it too.
527
528
- // The original posix_memalign check on the pointer is:
529
-
530
- // void *tmp = malloc(size);
531
- // if(tmp != NULL){
532
- // *ptr = tmp;
533
- // return 0;
534
- // }
535
- // return ENOMEM;
536
537
- // As _CPROVER_allocate used in malloc never returns null,
538
- // this check is not applicable and can be simplified:
539
540
- *ptr = malloc(size);
541
- return 0;
+ void *tmp = malloc(size);
+ if(tmp != (void *)0)
+ {
+ *ptr = tmp;
+ return 0;
+ }
+ return ENOMEM;
542
}
543
544
/* FUNCTION: random */
0 commit comments