mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 20:29:53 +00:00
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:
parent
e47ba74b07
commit
194878fbac
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user