diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-05-04 05:20:54 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-05-04 05:20:54 +0000 |
commit | 027731d7b514123af03287b42d7366291b58d6e0 (patch) | |
tree | 073ac170f665d1555465a353651c55820511a234 /clang/lib/Serialization/ModuleManager.cpp | |
parent | 1b1256a1b1bb665b86c7c74782e75f6e050973a8 (diff) | |
download | bcm5719-llvm-027731d7b514123af03287b42d7366291b58d6e0.tar.gz bcm5719-llvm-027731d7b514123af03287b42d7366291b58d6e0.zip |
Fix a use-after-free bug I recently introduced in lookupModuleFile
llvm-svn: 207932
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 9b3159e1705..66f18158a69 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -390,11 +390,10 @@ bool ModuleManager::lookupModuleFile(StringRef FileName, } if ((ExpectedSize && ExpectedSize != File->getSize()) || - (ExpectedModTime && ExpectedModTime != File->getModificationTime())) { - FileMgr.invalidateCache(File); - File = nullptr; + (ExpectedModTime && ExpectedModTime != File->getModificationTime())) + // Do not destroy File, as it may be referenced. If we need to rebuild it, + // it will be destroyed by removeModules. return true; - } return false; } |