forked from Imagelibrary/rtems
2010-06-22 Jennifer Averett <Jennifer.Averett@OARcorp.com>
* malloctest/init.c: Added error case with malloc of size 0.
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2010-06-22 Jennifer Averett <Jennifer.Averett@OARcorp.com>
|
||||
|
||||
* malloctest/init.c: Added error case with malloc of size 0.
|
||||
|
||||
2010-06-22 Jennifer Averett <Jennifer.Averett@OARcorp.com>
|
||||
|
||||
* malloctest/init.c: Added test to check failure branch on calloc.
|
||||
|
||||
@@ -1086,12 +1086,26 @@ rtems_task Init(
|
||||
status = rtems_clock_set( &time );
|
||||
directive_failed( status, "rtems_clock_set" );
|
||||
|
||||
/*
|
||||
* Verify case where block is too large to calloc.
|
||||
*/
|
||||
p1 = calloc( 1, SIZE_MAX );
|
||||
if (p1) {
|
||||
printf("ERROR on attempt to calloc SIZE_MAX block expected failure.");
|
||||
free( p1 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify error case where malloc of size 0.
|
||||
*/
|
||||
p1 = malloc( 0 );
|
||||
if (p1) {
|
||||
printf("ERROR on attempt to malloc size 0 block expected failure.");
|
||||
free( p1 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
test_heap_initialize();
|
||||
test_heap_block_allocate();
|
||||
test_heap_allocate();
|
||||
|
||||
Reference in New Issue
Block a user