aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVTables.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-03-20 20:18:13 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-03-20 20:18:13 +0000
commitfce80091da9e5d83d05944e36c834f9137dc329c (patch)
tree806aa12aa45ef0fc71d8b8b9a4a281ad4634d9da /lib/CodeGen/CGVTables.cpp
parenta03e40ce9d729fca50e817351e3b1b48691dcd64 (diff)
Fix a use-after-free in thunk emission. EmitThunk may call RAUW on Init, invalidating the pointer.
Fixes PR12284. The test case only triggered under asan/valgrind, but it's better than nothing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.cpp')
-rw-r--r--lib/CodeGen/CGVTables.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp
index e262de110e..17a053757e 100644
--- a/lib/CodeGen/CGVTables.cpp
+++ b/lib/CodeGen/CGVTables.cpp
@@ -584,8 +584,8 @@ CodeGenVTables::CreateVTableInitializer(const CXXRecordDecl *RD,
VTableThunks[NextVTableThunkIndex].first == I) {
const ThunkInfo &Thunk = VTableThunks[NextVTableThunkIndex].second;
- Init = CGM.GetAddrOfThunk(GD, Thunk);
MaybeEmitThunkAvailableExternally(GD, Thunk);
+ Init = CGM.GetAddrOfThunk(GD, Thunk);
NextVTableThunkIndex++;
} else {