From c4b6d0ebab4cfa0942aed43f030f3d57179c112e Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Wed, 30 May 2018 09:01:12 +0000 Subject: Revert commit 333506 It looks like this commit is responsible for the fail: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/24382. llvm-svn: 333518 --- llvm/lib/Support/SmallVector.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/SmallVector.cpp') diff --git a/llvm/lib/Support/SmallVector.cpp b/llvm/lib/Support/SmallVector.cpp index ccab4a1..74313151 100644 --- a/llvm/lib/Support/SmallVector.cpp +++ b/llvm/lib/Support/SmallVector.cpp @@ -25,13 +25,17 @@ void SmallVectorBase::grow_pod(void *FirstEl, size_t MinSizeInBytes, void *NewElts; if (BeginX == FirstEl) { - NewElts = safe_malloc(NewCapacityInBytes); + NewElts = malloc(NewCapacityInBytes); + if (NewElts == nullptr) + report_bad_alloc_error("Allocation of SmallVector element failed."); // 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 = safe_realloc(this->BeginX, NewCapacityInBytes); + NewElts = realloc(this->BeginX, NewCapacityInBytes); + if (NewElts == nullptr) + report_bad_alloc_error("Reallocation of SmallVector element failed."); } this->EndX = (char*)NewElts+CurSizeBytes; -- cgit v1.1