Closed Bug 962077 Opened 10 years ago Closed 10 years ago

netwerk/cache2/CacheFile.cpp:920:12: warning: ‘rv’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Categories

(Core :: Networking: Cache, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: froydnj, Assigned: mayhemer)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Unlike a lot of other maybe-uninitialized warnings, this looks like a honest-to-goodness bug:

  nsresult rv;

  if (mMemoryOnly) {
    // TODO what exactly to do here?
    return NS_ERROR_NOT_AVAILABLE;
  }

  nsCOMPtr<CacheFileIOListener> listener;
  if (aCallback || !mHandle) {
    listener = new DoomFileHelper(aCallback);
  }
  if (mHandle) {
    rv = CacheFileIOManager::DoomFile(mHandle, listener);
  } else if (mOpeningFile) {
    mDoomAfterOpenListener = listener;
  }

  return rv;

Notice that rv is never set in the !mHandle cases.
This could be causing some intermittent timeouts we see on try runs/gum.  Thanks!

Michal, want to fix this?  I think init to NS_OK is sufficient here (and move bellow if (mMemoryOnly) {}).
Attached patch v1Splinter Review
I took the liberty.  Hope you don't work on the patch right now :)
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Attachment #8363069 - Flags: review?(michal.novotny)
Attachment #8363069 - Flags: review?(michal.novotny) → review+
https://hg.mozilla.org/mozilla-central/rev/0a32c3d9f7c2
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: