summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/SmallVector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/SmallVector.cpp')
-rw-r--r--llvm/lib/Support/SmallVector.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Support/SmallVector.cpp b/llvm/lib/Support/SmallVector.cpp
index 74313151c76..ccab4a125aa 100644
--- a/llvm/lib/Support/SmallVector.cpp
+++ b/llvm/lib/Support/SmallVector.cpp
@@ -25,17 +25,13 @@ void SmallVectorBase::grow_pod(void *FirstEl, size_t MinSizeInBytes,
void *NewElts;
if (BeginX == FirstEl) {
- NewElts = malloc(NewCapacityInBytes);
- if (NewElts == nullptr)
- report_bad_alloc_error("Allocation of SmallVector element failed.");
+ NewElts = safe_malloc(NewCapacityInBytes);
// Copy the elements over. No need to run dtors on PODs.
memcpy(NewElts, this->BeginX, CurSizeBytes);
} else {
// If this wasn't grown from the inline copy, grow the allocated space.
- NewElts = realloc(this->BeginX, NewCapacityInBytes);
- if (NewElts == nullptr)
- report_bad_alloc_error("Reallocation of SmallVector element failed.");
+ NewElts = safe_realloc(this->BeginX, NewCapacityInBytes);
}
this->EndX = (char*)NewElts+CurSizeBytes;
OpenPOWER on IntegriCloud