malloc(0) is undefined, but we would prefer NULL. Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
@@ -66,9 +66,11 @@ MODULE_EXIT()
// Miscellaneous string functions...
ECLRTL_API void * rtlMalloc(size32_t size)
{
- void * retVal = malloc(size);
+ if (!size)
+ return NULL;
- if( size && !retVal)
+ void * retVal = malloc(size);
+ if (!retVal)
PrintStackReport();
rtlThrowOutOfMemory(0, "Memory allocation error!");