Avoid leaking memory in an error path. Noticed

by cppcheck.

llvm-svn: 73187
This commit is contained in:
Duncan Sands 2009-06-11 08:09:49 +00:00
parent d85a991253
commit 29491f03de
1 changed files with 4 additions and 3 deletions

View File

@ -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;