aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FoldingSet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/FoldingSet.cpp')
-rw-r--r--llvm/lib/Support/FoldingSet.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp
index ec7d575..9423795 100644
--- a/llvm/lib/Support/FoldingSet.cpp
+++ b/llvm/lib/Support/FoldingSet.cpp
@@ -214,8 +214,11 @@ static void **GetBucketFor(unsigned Hash, void **Buckets, unsigned NumBuckets) {
/// AllocateBuckets - Allocated initialized bucket memory.
static void **AllocateBuckets(unsigned NumBuckets) {
- void **Buckets = static_cast<void**>(safe_calloc(NumBuckets + 1,
- sizeof(void*)));
+ void **Buckets = static_cast<void**>(calloc(NumBuckets+1, sizeof(void*)));
+
+ if (Buckets == nullptr)
+ report_bad_alloc_error("Allocation of Buckets failed.");
+
// Set the very last bucket to be a non-null "pointer".
Buckets[NumBuckets] = reinterpret_cast<void*>(-1);
return Buckets;