Destroy allocated resources on exception.
[oota-llvm.git] / lib / VMCore / Linker.cpp
index 5280c04565f3f7fe6a004bb4fbcc9fde841641c6..81d46ca3f44f28f8f1695a5a3d89fba66a4a71da 100644 (file)
@@ -79,7 +79,9 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy,
   switch (DestTyT->getPrimitiveID()) {
   case Type::FunctionTyID: {
     if (cast<FunctionType>(DestTyT)->isVarArg() !=
-        cast<FunctionType>(SrcTyT)->isVarArg())
+        cast<FunctionType>(SrcTyT)->isVarArg() ||
+        cast<FunctionType>(DestTyT)->getNumContainedTypes() !=
+        cast<FunctionType>(SrcTyT)->getNumContainedTypes())
       return true;
     for (unsigned i = 0, e = getFT(DestTy)->getNumContainedTypes(); i != e; ++i)
       if (RecursiveResolveTypesI(getFT(DestTy)->getContainedType(i),