summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/StringMap.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2018-05-30 09:01:12 +0000
committerSerge Pavlov <sepavloff@gmail.com>2018-05-30 09:01:12 +0000
commitc4b6d0ebab4cfa0942aed43f030f3d57179c112e (patch)
treebe72544769b40276a162ab35157b347253cc1bf2 /llvm/lib/Support/StringMap.cpp
parentf426fc7000fb6c4875cdcd846c07069f025b2e3d (diff)
downloadbcm5719-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/StringMap.cpp')
-rw-r--r--llvm/lib/Support/StringMap.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Support/StringMap.cpp b/llvm/lib/Support/StringMap.cpp
index c1f707ce50a..79262cc6d3a 100644
--- a/llvm/lib/Support/StringMap.cpp
+++ b/llvm/lib/Support/StringMap.cpp
@@ -59,8 +59,10 @@ void StringMapImpl::init(unsigned InitSize) {
NumTombstones = 0;
TheTable = static_cast<StringMapEntryBase **>(
- safe_calloc(NewNumBuckets+1,
+ std::calloc(NewNumBuckets+1,
sizeof(StringMapEntryBase **) + sizeof(unsigned)));
+ if (TheTable == nullptr)
+ report_bad_alloc_error("Allocation of StringMap table failed.");
// Set the member only if TheTable was successfully allocated
NumBuckets = NewNumBuckets;
@@ -218,7 +220,9 @@ unsigned StringMapImpl::RehashTable(unsigned BucketNo) {
// Allocate one extra bucket which will always be non-empty. This allows the
// iterators to stop at end.
auto NewTableArray = static_cast<StringMapEntryBase **>(
- safe_calloc(NewSize+1, sizeof(StringMapEntryBase *) + sizeof(unsigned)));
+ std::calloc(NewSize+1, sizeof(StringMapEntryBase *) + sizeof(unsigned)));
+ if (NewTableArray == nullptr)
+ report_bad_alloc_error("Allocation of StringMap hash table failed.");
unsigned *NewHashArray = (unsigned *)(NewTableArray + NewSize + 1);
NewTableArray[NewSize] = (StringMapEntryBase*)2;
OpenPOWER on IntegriCloud