summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DataLayout.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/IR/DataLayout.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/IR/DataLayout.cpp')
-rw-r--r--llvm/lib/IR/DataLayout.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index 62c67127276..fff2f67fe5a 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -596,8 +596,10 @@ const StructLayout *DataLayout::getStructLayout(StructType *Ty) const {
// Otherwise, create the struct layout. Because it is variable length, we
// malloc it, then use placement new.
int NumElts = Ty->getNumElements();
- StructLayout *L = (StructLayout *)
- safe_malloc(sizeof(StructLayout)+(NumElts-1) * sizeof(uint64_t));
+ StructLayout *L =
+ (StructLayout *)malloc(sizeof(StructLayout)+(NumElts-1) * sizeof(uint64_t));
+ if (L == nullptr)
+ report_bad_alloc_error("Allocation of StructLayout elements failed.");
// Set SL before calling StructLayout's ctor. The ctor could cause other
// entries to be added to TheMap, invalidating our reference.
OpenPOWER on IntegriCloud