Skip to content

Commit aaf1149

Browse files
committed
[scudo] Respect the return value of ReservedMemory::create() (NFC)
Reviewed By: cferris Differential Revision: https://reviews.llvm.org/D156586
1 parent e010537 commit aaf1149

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler-rt/lib/scudo/standalone/secondary.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,14 +570,15 @@ void *MapAllocator<Config>::allocate(const Options &Options, uptr Size,
570570

571571
ReservedMemoryT ReservedMemory;
572572
const uptr MapSize = RoundedSize + 2 * PageSize;
573-
ReservedMemory.create(/*Addr=*/0U, MapSize, nullptr, MAP_ALLOWNOMEM);
573+
if (UNLIKELY(!ReservedMemory.create(/*Addr=*/0U, MapSize, nullptr,
574+
MAP_ALLOWNOMEM))) {
575+
return nullptr;
576+
}
574577

575578
// Take the entire ownership of reserved region.
576579
MemMapT MemMap = ReservedMemory.dispatch(ReservedMemory.getBase(),
577580
ReservedMemory.getCapacity());
578581
uptr MapBase = MemMap.getBase();
579-
if (UNLIKELY(!MapBase))
580-
return nullptr;
581582
uptr CommitBase = MapBase + PageSize;
582583
uptr MapEnd = MapBase + MapSize;
583584

0 commit comments

Comments
 (0)