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:
Jennifer Averett
2010-06-22 18:20:47 +00:00
parent 81110848dc
commit 91e446f3ab
2 changed files with 18 additions and 0 deletions

View File

@@ -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.

View File

@@ -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();