Closed Bug 1475282 Opened 7 years ago Closed 7 years ago

[Static Analysis] DEAD_STORE errors in toolkit/xre/ProfileReset.cpp

Categories

(Toolkit :: General, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: rbartlensky, Assigned: rbartlensky)

References

Details

Attachments

(1 file)

toolkit/xre/ProfileReset.cpp:84: error: DEAD_STORE The value written to &rv (type int) is never used. 82. 83. nsCOMPtr<nsIStringBundle> sb; 84. > rv = sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb)); 85. if (!sb) return NS_ERROR_FAILURE; 86. toolkit/xre/ProfileReset.cpp:93: error: DEAD_STORE The value written to &rv (type int) is never used. 91. 92. static const char* kResetBackupDirectory = "resetBackupDirectory"; 93. > rv = sb->FormatStringFromName(kResetBackupDirectory, params, 2, 94. resetBackupDirectoryName); 95. rv is certainly not used in any of those cases, could we drop the return value of the function instead of assigning it?
Blocks: infer
Comment on attachment 8992402 [details] Bug 1475282: Fix DEAD_STORE issues in ProfileReset. https://reviewboard.mozilla.org/r/257280/#review264094 Thanks for the cleanup, just a few minor requests. ::: commit-message-2ed15:1 (Diff revision 1) > +Bug 1475282: Remove unnecessary assingments. r?erahm nit: 'assignments'. Can you expand this to be a little more explicit, ie "... in ProfileReset" ::: netwerk/mime/nsMIMEHeaderParamImpl.cpp:455 (Diff revision 1) > while (*str) { > // find name/value > > const char *nameStart = str; > const char *nameEnd = nullptr; > - const char *valueStart = str; > + const char *valueStart = nullptr; This should be in a separate bug and a [necko peer](https://wiki.mozilla.org/Modules/Core#Necko) will probably want to review it. ::: toolkit/xre/ProfileReset.cpp:84 (Diff revision 1) > // Get the friendly name for the backup directory. > nsCOMPtr<nsIStringBundleService> sbs = mozilla::services::GetStringBundleService(); > if (!sbs) return NS_ERROR_FAILURE; > > nsCOMPtr<nsIStringBundle> sb; > - rv = sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb)); > + sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb)); Please use `Unused <<` here. ::: toolkit/xre/ProfileReset.cpp:94 (Diff revision 1) > > nsAutoString resetBackupDirectoryName; > > static const char* kResetBackupDirectory = "resetBackupDirectory"; > - rv = sb->FormatStringFromName(kResetBackupDirectory, params, 2, > + sb->FormatStringFromName(kResetBackupDirectory, params, 2, > - resetBackupDirectoryName); > + resetBackupDirectoryName); Please convert this to check `rv` and return on failure.
Attachment #8992402 - Flags: review?(erahm) → review-
Comment on attachment 8992402 [details] Bug 1475282: Fix DEAD_STORE issues in ProfileReset. https://reviewboard.mozilla.org/r/257280/#review264094 > This should be in a separate bug and a [necko peer](https://wiki.mozilla.org/Modules/Core#Necko) will probably want to review it. I am not sure how this slipped in, I have a separate bug for that, thank you for pointing it out!
Comment on attachment 8992402 [details] Bug 1475282: Fix DEAD_STORE issues in ProfileReset. https://reviewboard.mozilla.org/r/257280/#review264436 Looks good, thanks for the fix.
Attachment #8992402 - Flags: review?(erahm) → review+
Keywords: checkin-needed
Pushed by ebalazs@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bce13e8f7d19 Fix DEAD_STORE issues in ProfileReset. r=erahm
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: