Closed
Bug 1258339
Opened 8 years ago
Closed 8 years ago
[Static Analysis][Unused value] In function CustomCleanupCallback::Cleanup
Categories
(Core :: Storage: IndexedDB, defect)
Core
Storage: IndexedDB
Tracking
()
RESOLVED
FIXED
mozilla48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: andi, Assigned: andi)
References
(Blocks 1 open bug)
Details
(Keywords: coverity, Whiteboard: CID 1357091)
Attachments
(1 file)
The Static Analysis tool Coverity added that |rv| is assigned a value that afterwards in never used: >> if (aFileManager->EnforcingQuota()) { >> rv = file->GetFileSize(&fileSize); >> if (NS_WARN_IF(!file)) { >> return NS_ERROR_FAILURE; >> } >> } I consider that in case of GetFileSize fails the correct behavior would be: >> if (aFileManager->EnforcingQuota()) { >> rv = file->GetFileSize(&fileSize); >> if (NS_WARN_IF(NS_FAILED(rv))) { >> return rv; >> } >> } In case GetFileSize gets called we are safe to assume that file is a valid nsCOMPtr<nsIFile> because of the earlier checker from the start of the function: >> nsCOMPtr<nsIFile> file = aFileManager->GetFileForId(mDirectory, aId); >> if (NS_WARN_IF(!file)) { >> return NS_ERROR_FAILURE; >> } so checking again the validity of file is useless.
Comment 1•8 years ago
|
||
Yes, you are right.
Assignee | ||
Comment 2•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/41391/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/41391/
Attachment #8732828 -
Flags: review?(jvarga)
Assignee | ||
Comment 3•8 years ago
|
||
that was wicked fast Jan :)
Comment 4•8 years ago
|
||
Comment on attachment 8732828 [details] MozReview Request: Bug 1258339 - check return value of GetFileSize. r?janv https://reviewboard.mozilla.org/r/41391/#review37863 r=me, Thanks!
Attachment #8732828 -
Flags: review?(jvarga) → review+
Comment 6•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a84154aad442
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in
before you can comment on or make changes to this bug.
Description
•