diff options
Diffstat (limited to 'cpukit/libcsupport/src/rtemscalloc.c')
-rw-r--r-- | cpukit/libcsupport/src/rtemscalloc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cpukit/libcsupport/src/rtemscalloc.c b/cpukit/libcsupport/src/rtemscalloc.c index 836f1da64d..7e05a14bb1 100644 --- a/cpukit/libcsupport/src/rtemscalloc.c +++ b/cpukit/libcsupport/src/rtemscalloc.c @@ -47,13 +47,14 @@ void *rtems_calloc( size_t nelem, size_t elsize ) void *p; if ( nelem == 0 ) { - length = 0; - } else if ( elsize > SIZE_MAX / nelem ) { return NULL; - } else { - length = nelem * elsize; } + if ( elsize > SIZE_MAX / nelem ) { + return NULL; + } + + length = nelem * elsize; p = rtems_malloc( length ); RTEMS_OBFUSCATE_VARIABLE( p ); if ( RTEMS_PREDICT_FALSE( p == NULL ) ) { |