@@ -56,7 +56,7 @@ FIRCLSAllocatorRef FIRCLSAllocatorCreate(size_t writableSpace, size_t readableSp
56
56
}
57
57
58
58
// Make one big, continuous allocation, adding additional pages for our guards. Note
59
- // that we cannot use malloc (or valloc) in this case, because we need to assert full
59
+ // that we cannot use malloc, calloc (or valloc) in this case, because we need to assert full
60
60
// ownership over these allocations. mmap is a much better choice. We also mark these
61
61
// pages as MAP_NOCACHE.
62
62
allocationSize = writableRegion .size + readableRegion .size + pageSize * 3 ;
@@ -174,10 +174,10 @@ void* FIRCLSAllocatorSafeAllocateFromRegion(FIRCLSAllocationRegion* region, size
174
174
175
175
// this shouldn't happen unless we make a mistake with our size pre-computations
176
176
if ((uintptr_t )originalCursor - (uintptr_t )region -> start + size > region -> size ) {
177
- FIRCLSSDKLog ("Unable to allocate sufficient memory, falling back to malloc \n" );
177
+ FIRCLSSDKLog ("Unable to allocate sufficient memory, falling back to calloc \n" );
178
178
void * ptr = calloc (1 , size );
179
179
if (!ptr ) {
180
- FIRCLSSDKLog ("Unable to malloc in FIRCLSAllocatorSafeAllocateFromRegion\n" );
180
+ FIRCLSSDKLog ("Unable to calloc in FIRCLSAllocatorSafeAllocateFromRegion\n" );
181
181
return NULL ;
182
182
}
183
183
return ptr ;
@@ -195,21 +195,21 @@ void* FIRCLSAllocatorSafeAllocate(FIRCLSAllocatorRef allocator,
195
195
FIRCLSAllocationRegion * region ;
196
196
197
197
if (!allocator ) {
198
- // fall back to malloc in this case
199
- FIRCLSSDKLog ("Allocator invalid, falling back to malloc \n" );
198
+ // fall back to calloc in this case
199
+ FIRCLSSDKLog ("Allocator invalid, falling back to calloc \n" );
200
200
void * ptr = calloc (1 , size );
201
201
if (!ptr ) {
202
- FIRCLSSDKLog ("Unable to malloc in FIRCLSAllocatorSafeAllocate\n" );
202
+ FIRCLSSDKLog ("Unable to calloc in FIRCLSAllocatorSafeAllocate\n" );
203
203
return NULL ;
204
204
}
205
205
return ptr ;
206
206
}
207
207
208
208
if (allocator -> protectionEnabled ) {
209
- FIRCLSSDKLog ("Allocator already protected, falling back to malloc \n" );
209
+ FIRCLSSDKLog ("Allocator already protected, falling back to calloc \n" );
210
210
void * ptr = calloc (1 , size );
211
211
if (!ptr ) {
212
- FIRCLSSDKLog ("Unable to malloc in FIRCLSAllocatorSafeAllocate\n" );
212
+ FIRCLSSDKLog ("Unable to calloc in FIRCLSAllocatorSafeAllocate\n" );
213
213
return NULL ;
214
214
}
215
215
return ptr ;
0 commit comments