mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Validate the return type when checking if a function is malloc.
Fixes PR11426. Not sure if a test case with a "wrong" malloc would be useful. llvm-svn: 145106
This commit is contained in:
parent
3c1878ef53
commit
f7f6231b4b
@ -48,10 +48,10 @@ static bool isMallocCall(const CallInst *CI) {
|
||||
// FIXME: workaround for PR5130, this will be obsolete when a nobuiltin
|
||||
// attribute will exist.
|
||||
FunctionType *FTy = Callee->getFunctionType();
|
||||
if (FTy->getNumParams() != 1)
|
||||
return false;
|
||||
return FTy->getParamType(0)->isIntegerTy(32) ||
|
||||
FTy->getParamType(0)->isIntegerTy(64);
|
||||
return FTy->getReturnType() == Type::getInt8PtrTy(FTy->getContext()) &&
|
||||
FTy->getNumParams() == 1 &&
|
||||
(FTy->getParamType(0)->isIntegerTy(32) ||
|
||||
FTy->getParamType(0)->isIntegerTy(64));
|
||||
}
|
||||
|
||||
/// extractMallocCall - Returns the corresponding CallInst if the instruction
|
||||
|
Loading…
x
Reference in New Issue
Block a user