mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Prevent the existance of dangling pointers upon failure of FindDataStart.
This commit is contained in:
parent
89ad46ab66
commit
27ea0aaf55
1 changed files with 2 additions and 1 deletions
|
|
@ -217,16 +217,17 @@ nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret,
|
||||||
#else
|
#else
|
||||||
handle->mNSPRFileDesc = fd.forget();
|
handle->mNSPRFileDesc = fd.forget();
|
||||||
#endif
|
#endif
|
||||||
handle->mMap = map;
|
|
||||||
handle->mFile.Init(file);
|
handle->mFile.Init(file);
|
||||||
handle->mTotalLen = (uint32_t) size;
|
handle->mTotalLen = (uint32_t) size;
|
||||||
handle->mFileStart = buf;
|
handle->mFileStart = buf;
|
||||||
rv = handle->findDataStart();
|
rv = handle->findDataStart();
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
PR_MemUnmap(buf, (uint32_t) size);
|
PR_MemUnmap(buf, (uint32_t) size);
|
||||||
|
handle->mFileStart = nullptr;
|
||||||
PR_CloseFileMap(map);
|
PR_CloseFileMap(map);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
handle->mMap = map;
|
||||||
handle.forget(ret);
|
handle.forget(ret);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue