Merge "idmap2: ZipFile::Open: fix potential memory leak"
This commit is contained in:
committed by
Android (Google) Code Review
commit
a198f02a97
@@ -34,6 +34,7 @@ std::unique_ptr<const ZipFile> ZipFile::Open(const std::string& path) {
|
||||
::ZipArchiveHandle handle;
|
||||
int32_t status = ::OpenArchive(path.c_str(), &handle);
|
||||
if (status != 0) {
|
||||
::CloseArchive(handle);
|
||||
return nullptr;
|
||||
}
|
||||
return std::unique_ptr<ZipFile>(new ZipFile(handle));
|
||||
|
||||
Reference in New Issue
Block a user