Loading...
--- dyld/dyld-1122.1/common/FileManager.cpp
+++ dyld/dyld-1235.2/common/FileManager.cpp
@@ -56,7 +56,9 @@
FileRecord FileManager::fileRecordForPath(Allocator& allocator, const char* filePath) {
- auto str = allocator.strdup(filePath);
+ const char* str = nullptr;
+ if ( filePath )
+ str = allocator.strdup(filePath);
return FileRecord(*this, UniquePtr<const char>(str));
}
@@ -93,6 +95,7 @@
} __attribute__((aligned(4), packed));
typedef struct VolAttrBuf VolAttrBuf;
+ STACK_ALLOCATOR(ephemeralAllocator, 0);
while (1) {
int fsCount = getfsstat(nullptr, 0, MNT_NOWAIT);
if (fsCount == -1) {
@@ -100,10 +103,10 @@
break;
}
int fsInfoSize = fsCount*sizeof(struct statfs);
- auto fsInfos = (struct statfs *)_allocator->malloc(fsInfoSize);
+ auto fsInfos = (struct statfs *)ephemeralAllocator.malloc(fsInfoSize);
if (this->getfsstat(fsInfos, fsInfoSize, MNT_NOWAIT) != fsCount) {
// Retry
- _allocator->free((void*)fsInfos);
+ ephemeralAllocator.free((void*)fsInfos);
continue;
}
for (auto i = 0; i < fsCount; ++i) {
@@ -136,7 +139,7 @@
_fsUUIDMap->insert({f_fsid, UUID()});
}
}
- _allocator->free((void*)fsInfos);
+ ephemeralAllocator.free((void*)fsInfos);
break;
}
}