Don't call memset if malloc returns a null pointer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16797 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-10-06 23:08:03 +00:00
parent e47ba74b07
commit 194878fbac

View File

@ -28,5 +28,6 @@ void *calloc(size_t nelem, size_t elsize) __ATTRIBUTE_WEAK__;
void *calloc(size_t nelem, size_t elsize) {
void *Result = malloc(nelem*elsize);
return memset(Result, 0, nelem*elsize);
if (Result) memset(Result, 0, nelem*elsize);
return Result;
}