Closed Bug 886184 Opened 7 years ago Closed 7 years ago

Local variable usage may get used uninitialized

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: ehsan, Assigned: mayhemer)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

15:39.37 ../../../../dom/src/storage/DOMStorageDBThread.cpp:859:9: warning: variable 'usage' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
15:39.37     if (exists) {
15:39.37         ^~~~~~
15:39.37 ../../../../dom/src/storage/DOMStorageDBThread.cpp:864:23: note: uninitialized use occurs here
15:39.37     mUsage->LoadUsage(usage);
15:39.37                       ^~~~~
15:39.38 ../../../../dom/src/storage/DOMStorageDBThread.cpp:859:5: note: remove the 'if' if its condition is always true
15:39.38     if (exists) {
15:39.38     ^~~~~~~~~~~~
15:39.38 ../../../../dom/src/storage/DOMStorageDBThread.cpp:858:18: note: initialize the variable 'usage' to silence this warning
15:39.38     int64_t usage;
15:39.38                  ^
15:39.38                   = 0
15:39.38 1 warning generated.
Attached patch v1Splinter Review
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Attachment #766651 - Flags: review?(ehsan)
Comment on attachment 766651 [details] [diff] [review]
v1

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

Great!  I wasn't sure what default value would make sense here.
Attachment #766651 - Flags: review?(ehsan) → review+
mayhemer, looks like this just needs checking in, yes?
Flags: needinfo?(honzab.moz)
OS: Mac OS X → All
Hardware: x86 → All
(In reply to Daniel Holbert [:dholbert] from comment #4)
> mayhemer, looks like this just needs checking in, yes?

Yes. Go ahead please!
Flags: needinfo?(honzab.moz)
Keywords: checkin-needed
(In reply to Honza Bambas (:mayhemer) from comment #5)
> Yes. Go ahead please!

(Note that the patch doesn't currently have any headers (no author info, no commit message). It's nice to include those before requesting that someone else check in your patch. Hopefully whoever checks it in will be kind enough to add those things, but it's generally better to not put that burden on the checkin-needed-watchers, since it adds extra work for them & it often results in patches being mis-attributed.)
(inbound was closed earlier, but it just re-opened, so I went ahead & added the patch headers & landed this:  https://hg.mozilla.org/integration/mozilla-inbound/rev/03332f9c6529 )
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/03332f9c6529
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.