diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2018-05-30 09:01:12 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2018-05-30 09:01:12 +0000 |
commit | c4b6d0ebab4cfa0942aed43f030f3d57179c112e (patch) | |
tree | be72544769b40276a162ab35157b347253cc1bf2 /llvm/lib/Support/SmallPtrSet.cpp | |
parent | f426fc7000fb6c4875cdcd846c07069f025b2e3d (diff) | |
download | bcm5719-llvm-c4b6d0ebab4cfa0942aed43f030f3d57179c112e.tar.gz bcm5719-llvm-c4b6d0ebab4cfa0942aed43f030f3d57179c112e.zip |
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
Diffstat (limited to 'llvm/lib/Support/SmallPtrSet.cpp')
-rw-r--r-- | llvm/lib/Support/SmallPtrSet.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/llvm/lib/Support/SmallPtrSet.cpp b/llvm/lib/Support/SmallPtrSet.cpp index fed4a17d663..119bb871d4c 100644 --- a/llvm/lib/Support/SmallPtrSet.cpp +++ b/llvm/lib/Support/SmallPtrSet.cpp @@ -32,7 +32,9 @@ void SmallPtrSetImplBase::shrink_and_clear() { NumNonEmpty = NumTombstones = 0; // Install the new array. Clear all the buckets to empty. - CurArray = (const void**)safe_malloc(sizeof(void*) * CurArraySize); + CurArray = (const void**)malloc(sizeof(void*) * CurArraySize); + if (CurArray == nullptr) + report_bad_alloc_error("Allocation of SmallPtrSet bucket array failed."); memset(CurArray, -1, CurArraySize*sizeof(void*)); } @@ -98,7 +100,9 @@ void SmallPtrSetImplBase::Grow(unsigned NewSize) { bool WasSmall = isSmall(); // Install the new array. Clear all the buckets to empty. - const void **NewBuckets = (const void**) safe_malloc(sizeof(void*) * NewSize); + const void **NewBuckets = (const void**) malloc(sizeof(void*) * NewSize); + if (NewBuckets == nullptr) + report_bad_alloc_error("Allocation of SmallPtrSet bucket array failed."); // Reset member only if memory was allocated successfully CurArray = NewBuckets; @@ -128,7 +132,9 @@ SmallPtrSetImplBase::SmallPtrSetImplBase(const void **SmallStorage, CurArray = SmallArray; // Otherwise, allocate new heap space (unless we were the same size) } else { - CurArray = (const void**)safe_malloc(sizeof(void*) * that.CurArraySize); + CurArray = (const void**)malloc(sizeof(void*) * that.CurArraySize); + if (CurArray == nullptr) + report_bad_alloc_error("Allocation of SmallPtrSet bucket array failed."); } // Copy over the that array. @@ -157,12 +163,16 @@ void SmallPtrSetImplBase::CopyFrom(const SmallPtrSetImplBase &RHS) { // Otherwise, allocate new heap space (unless we were the same size) } else if (CurArraySize != RHS.CurArraySize) { if (isSmall()) - CurArray = (const void**)safe_malloc(sizeof(void*) * RHS.CurArraySize); + CurArray = (const void**)malloc(sizeof(void*) * RHS.CurArraySize); else { - const void **T = (const void**)safe_realloc(CurArray, + const void **T = (const void**)realloc(CurArray, sizeof(void*) * RHS.CurArraySize); + if (!T) + free(CurArray); CurArray = T; } + if (CurArray == nullptr) + report_bad_alloc_error("Allocation of SmallPtrSet bucket array failed."); } CopyHelper(RHS); |