[llvm-commits] CVS: llvm/runtime/GCCLibraries/libc/memory.c

Chris Lattner lattner at cs.uiuc.edu
Wed Oct 6 16:08:20 PDT 2004



Changes in directory llvm/runtime/GCCLibraries/libc:

memory.c updated: 1.4 -> 1.5
---
Log message:

Don't call memset if malloc returns a null pointer


---
Diffs of the changes:  (+2 -1)

Index: llvm/runtime/GCCLibraries/libc/memory.c
diff -u llvm/runtime/GCCLibraries/libc/memory.c:1.4 llvm/runtime/GCCLibraries/libc/memory.c:1.5
--- llvm/runtime/GCCLibraries/libc/memory.c:1.4	Tue Dec 16 16:57:30 2003
+++ llvm/runtime/GCCLibraries/libc/memory.c	Wed Oct  6 18:08:03 2004
@@ -28,5 +28,6 @@
 
 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;
 }






More information about the llvm-commits mailing list