diff options
Diffstat (limited to 'cpukit/libcsupport/src/rtemscalloc.c')
-rw-r--r-- | cpukit/libcsupport/src/rtemscalloc.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cpukit/libcsupport/src/rtemscalloc.c b/cpukit/libcsupport/src/rtemscalloc.c index 836f1da64d..5cf9cd9613 100644 --- a/cpukit/libcsupport/src/rtemscalloc.c +++ b/cpukit/libcsupport/src/rtemscalloc.c @@ -9,7 +9,7 @@ */ /* - * Copyright (C) 2018 embedded brains GmbH (http://www.embedded-brains.de) + * Copyright (C) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -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 ) ) { |