Prevent the existance of dangling pointers upon failure of FindDataStart.

This commit is contained in:
Fedor 2020-05-09 00:36:23 +03:00
parent f86309421d
commit 9bcdb8f762
1 changed files with 2 additions and 1 deletions

View File

@ -217,16 +217,17 @@ nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret,
#else
handle->mNSPRFileDesc = fd.forget();
#endif
handle->mMap = map;
handle->mFile.Init(file);
handle->mTotalLen = (uint32_t) size;
handle->mFileStart = buf;
rv = handle->findDataStart();
if (NS_FAILED(rv)) {
PR_MemUnmap(buf, (uint32_t) size);
handle->mFileStart = nullptr;
PR_CloseFileMap(map);
return rv;
}
handle->mMap = map;
handle.forget(ret);
return NS_OK;
}