Loading...
--- dyld/dyld-551.3/src/dyldNew.cpp
+++ dyld/dyld-360.22/src/dyldNew.cpp
@@ -62,7 +62,7 @@
void* malloc(size_t size)
{
- if ( (dyld::gLibSystemHelpers != NULL) && dyld::gProcessInfo->libSystemInitialized ) {
+ if ( dyld::gLibSystemHelpers != NULL) {
void* p = dyld::gLibSystemHelpers->malloc(size);
//dyld::log("malloc(%lu) => %p from libSystem\n", size, p);
return p;
@@ -126,20 +126,18 @@
void* calloc(size_t count, size_t size)
{
- // Check for overflow of integer multiplication
- size_t total = count * size;
- if ( total/count != size ) {
- dyld::log("dyld calloc overflow: count=%zu, size=%zu\n", count, size);
- dyld::halt("dyld calloc overflow");
- }
if ( dyld::gLibSystemHelpers != NULL ) {
- void* result = dyld::gLibSystemHelpers->malloc(total);
- if ( result != NULL )
- bzero(result, total);
+ void* result = dyld::gLibSystemHelpers->malloc(size*count);
+ bzero(result, size*count);
return result;
}
else {
- // this allocates out of static buffer which is already zero filled
+ // Check for overflow of integer multiplication
+ size_t total = count * size;
+ if ( total/count != size ) {
+ dyld::log("dyld calloc overflow: count=%zu, size=%zu\n", count, size);
+ exit(1);
+ }
return malloc(total);
}
}