diff options
author | Reid Kleckner <rnk@google.com> | 2016-09-02 01:10:53 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-09-02 01:10:53 +0000 |
commit | 1a4398a1986bd7c2fc34048cd07e6b221ebbd882 (patch) | |
tree | 559de5b30cd25d7d82da0bb90d836ccff9f8c38c /llvm/unittests/Support/Path.cpp | |
parent | d4e80a9615639942f62ac808cdb195105218f813 (diff) | |
download | bcm5719-llvm-1a4398a1986bd7c2fc34048cd07e6b221ebbd882.tar.gz bcm5719-llvm-1a4398a1986bd7c2fc34048cd07e6b221ebbd882.zip |
Fix a real temp file leak in FileOutputBuffer
If we failed to commit the buffer but did not die to a signal, the temp
file would remain on disk on Windows. Having an open file mapping and
file handle prevents the file from being deleted. I am choosing not to
add an assertion of success on the temp file removal, since virus
scanners and other environmental things can often cause removal to fail
in real world tools.
Also fix more temp file leaks in unit tests.
llvm-svn: 280445
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 0c612293a96..bd12b3b8c84 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -488,6 +488,8 @@ TEST_F(FileSystemTest, Unique) { fs::createUniqueDirectory("dir2", Dir2)); ASSERT_NO_ERROR(fs::getUniqueID(Dir2.c_str(), F2)); ASSERT_NE(F1, F2); + ASSERT_NO_ERROR(fs::remove(Dir1)); + ASSERT_NO_ERROR(fs::remove(Dir2)); ASSERT_NO_ERROR(fs::remove(TempPath2)); ASSERT_NO_ERROR(fs::remove(TempPath)); } |