Changeset 27698 in webkit for trunk/JavaScriptCore/wtf/FastMalloc.cpp
- Timestamp:
- Nov 11, 2007, 7:36:03 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/FastMalloc.cpp
r27336 r27698 2293 2293 #endif 2294 2294 void* calloc(size_t n, size_t elem_size) { 2295 void* result = do_malloc(n * elem_size); 2295 const size_t totalBytes = n * elem_size; 2296 2297 // Protect against overflow 2298 if (n > 1 && elem_size && (totalBytes / elem_size) != n) 2299 return 0; 2300 2301 void* result = do_malloc(totalBytes); 2296 2302 if (result != NULL) { 2297 memset(result, 0, n * elem_size);2298 } 2299 #ifndef WTF_CHANGES 2300 MallocHook::InvokeNewHook(result, n * elem_size);2303 memset(result, 0, totalBytes); 2304 } 2305 #ifndef WTF_CHANGES 2306 MallocHook::InvokeNewHook(result, totalBytes); 2301 2307 #endif 2302 2308 return result;
Note:
See TracChangeset
for help on using the changeset viewer.