Closed Bug 1230939 Opened 9 years ago Closed 9 years ago

[Static Analysis][Unchecked return value] Function CacheStorageService::DoomStorageEntries from CacheStorageService.cpp

Categories

(Core :: Networking: Cache, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1338022)

Attachments

(1 file)

The Static Analysis tool Coverity added that the return value from: 

>>  sGlobalEntryTables->Get(aContextKey, &diskEntries);

is not checked and later on the succes of the function is checked with the value from diskEntries pointer:

>>  if (memoryEntries && diskEntries) {

In order to silence the analyzer i propose the attached patch.
Attached patch Bug 1230939.diffSplinter Review
Hello Patrick,

Could you please take a look other this patch. Not only it silences the static analysis tool - Coverity but also i think it adds some performance gain since memoryEntries could be null, sGlobalEntryTables->Get(aContextKey, &diskEntries) will not get called.

THX
Attachment #8696463 - Flags: review?(mcmanus)
Comment on attachment 8696463 [details] [diff] [review]
Bug 1230939.diff

Review of attachment 8696463 [details] [diff] [review]:
-----------------------------------------------------------------

Stealing from Patrick (hope he doesn't mind) as this is my code.  This looks good.  Thanks.
Attachment #8696463 - Flags: review?(mcmanus) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/984b095feb49
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: