Closed Bug 36795 Opened 25 years ago Closed 25 years ago

Returning uninitialized variable

Categories

(SeaMonkey :: Bookmarks & History, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jim_nance, Assigned: mozilla)

Details

The following code is returning rv uninitialized: nsresult nsBookmarksService::getLocaleString(const char *key, nsString &str) { PRUnichar *keyUni = nsnull; nsAutoString keyStr; keyStr.AssignWithConversion(key); nsresult rv; if (mBundle && (NS_SUCCEEDED(rv = mBundle->GetStringFromName(keyStr.GetU nicode(), &keyUni))) && (keyUni)) { str = keyUni; nsCRT::free(keyUni); } else { str.Truncate(); } return(rv); } Notice that if mBundle is 0, then rv is not set before it is returned. I would just fix this, but I dont know what it should return in that case. This code is at line 1978 of xpfe/components/bookmarks/src/nsBookmarksService.cpp
-->rjc
Assignee: slamm → rjc
Fixed.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
code-level fix, markng VERIFIED
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.