projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e47ba74
)
Don't call memset if malloc returns a null pointer
author
Chris Lattner
<sabre@nondot.org>
Wed, 6 Oct 2004 23:08:03 +0000
(23:08 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Wed, 6 Oct 2004 23:08:03 +0000
(23:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16797
91177308
-0d34-0410-b5e6-
96231b3b80d8
runtime/GCCLibraries/libc/memory.c
patch
|
blob
|
history
diff --git
a/runtime/GCCLibraries/libc/memory.c
b/runtime/GCCLibraries/libc/memory.c
index 64aef89094a4d5e03358f7f420808fc5d5740cae..ebca404d488172305ab453de1f01f0a5240d2c78 100644
(file)
--- a/
runtime/GCCLibraries/libc/memory.c
+++ b/
runtime/GCCLibraries/libc/memory.c
@@
-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;
}