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:
fa3f80a
)
Avoid leaking memory in an error path. Noticed
author
Duncan Sands
<baldrick@free.fr>
Thu, 11 Jun 2009 08:09:49 +0000
(08:09 +0000)
committer
Duncan Sands
<baldrick@free.fr>
Thu, 11 Jun 2009 08:09:49 +0000
(08:09 +0000)
by cppcheck.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73187
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Archive/ArchiveWriter.cpp
patch
|
blob
|
history
diff --git
a/lib/Archive/ArchiveWriter.cpp
b/lib/Archive/ArchiveWriter.cpp
index 336a2bdc6586195cbe0296e43893078420962d0c..cebb087745794012c5605e98616076f52b612e34 100644
(file)
--- a/
lib/Archive/ArchiveWriter.cpp
+++ b/
lib/Archive/ArchiveWriter.cpp
@@
-167,10
+167,11
@@
Archive::addFileBefore(const sys::Path& filePath, iterator where,
mbr->data = 0;
mbr->path = filePath;
const sys::FileStatus *FSInfo = mbr->path.getFileStatus(false, ErrMsg);
- if (FSInfo)
- mbr->info = *FSInfo;
- else
+ if (!FSInfo) {
+ delete mbr;
return true;
+ }
+ mbr->info = *FSInfo;
unsigned flags = 0;
bool hasSlash = filePath.toString().find('/') != std::string::npos;