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

RESOLVED FIXED in Firefox 45

Status

()

Core
Networking: Cache
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: andi, Assigned: andi)

Tracking

(Blocks: 1 bug, {coverity})

Trunk
mozilla45
coverity
Points:
---

Firefox Tracking Flags

(firefox45 fixed)

Details

(Whiteboard: CID 1338022)

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
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.
(Assignee)

Comment 1

2 years ago
Created attachment 8696463 [details] [diff] [review]
Bug 1230939.diff

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+
(Assignee)

Updated

2 years ago
Keywords: checkin-needed

Comment 4

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/984b095feb49
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox45: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.