projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0901b15
)
Support/Path: remove raw delete
author
Dylan Noblesmith
<nobled@dreamwidth.org>
Mon, 25 Aug 2014 00:58:13 +0000
(
00:58
+0000)
committer
Dylan Noblesmith
<nobled@dreamwidth.org>
Mon, 25 Aug 2014 00:58:13 +0000
(
00:58
+0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216360
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Support/Path.cpp
patch
|
blob
|
history
diff --git
a/lib/Support/Path.cpp
b/lib/Support/Path.cpp
index 4d179218f78c7781d7b5cfc0a4be6abb306ff283..f633967697c965cd1b8968eb1a4f7f7bee2f455a 100644
(file)
--- a/
lib/Support/Path.cpp
+++ b/
lib/Support/Path.cpp
@@
-881,7
+881,8
@@
std::error_code copy_file(const Twine &From, const Twine &To) {
}
const size_t BufSize = 4096;
- char *Buf = new char[BufSize];
+ std::vector<char> Buffer(BufSize);
+ char *Buf = Buffer.data();
int BytesRead = 0, BytesWritten = 0;
for (;;) {
BytesRead = read(ReadFD, Buf, BufSize);
@@
-898,7
+899,6
@@
std::error_code copy_file(const Twine &From, const Twine &To) {
}
close(ReadFD);
close(WriteFD);
- delete[] Buf;
if (BytesRead < 0 || BytesWritten < 0)
return std::error_code(errno, std::generic_category());