Closed
Bug 1282085
Opened 8 years ago
Closed 26 days ago
(coverity) uninitialized scalar variable: mailnews/imap/src/nsImapMailFolder.cpp: |rv| is not set in an execution path before being returned by |return rv|
Categories
(MailNews Core :: Networking: IMAP, defect)
MailNews Core
Networking: IMAP
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: ishikawa, Unassigned)
References
(Blocks 1 open bug, )
Details
(Keywords: coverity, Whiteboard: CID 1137535)
Coverity found this:
|rv| is not set in an execution path before it is returned by |return rv|;
4042NS_IMETHODIMP nsImapMailFolder::FolderPrivileges(nsIMsgWindow *window)
4043{
2. Condition !!!window, taking false branch
3. Condition !!!window, taking false branch
4044 NS_ENSURE_ARG_POINTER(window);
1. var_decl: Declaring variable rv without initializer.
4045 nsresult rv ; // if no window...
4046#ifdef DEBUG_bienvenu
4047 m_adminUrl.Assign("http://www.netscape.com");
4048#endif
4. Condition !this->m_adminUrl.IsEmpty(), taking true branch
4049 if (!m_adminUrl.IsEmpty())
4050 {
4051 nsCOMPtr<nsIExternalProtocolService> extProtService = do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID);
5. Condition extProtService.operator bool(), taking false branch
4052 if (extProtService)
4053 {
4054 nsAutoCString scheme;
4055 nsCOMPtr<nsIURI> uri;
4056 if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(uri), m_adminUrl.get())))
4057 return rv;
4058 uri->GetScheme(scheme);
4059 if (!scheme.IsEmpty())
4060 {
4061 // if the URL scheme does not correspond to an exposed protocol, then we
4062 // need to hand this link click over to the external protocol handler.
4063 bool isExposed;
4064 rv = extProtService->IsExposedProtocol(scheme.get(), &isExposed);
4065 if (NS_SUCCEEDED(rv) && !isExposed)
4066 return extProtService->LoadUrl(uri);
4067 }
4068 }
6. Falling through to end of if statement
4069 }
4070 else
4071 {
4072 nsCOMPtr<nsIImapService> imapService = do_GetService(NS_IMAPSERVICE_CONTRACTID, &rv);
4073 NS_ENSURE_SUCCESS(rv,rv);
4074 rv = imapService->GetFolderAdminUrl(this, window, this, nullptr);
4075 if (NS_SUCCEEDED(rv))
4076 m_urlRunning = true;
4077 }
CID 1137535 (#1 of 1): Uninitialized scalar variable (UNINIT)7. uninit_use: Using uninitialized value rv.
4078 return rv;
4079}
4080
Observation: |rv| ought to be always set.
I suspect returning NS_ERROR_FAILURE or some such error might be in order.
TIA
Updated•2 years ago
|
Severity: normal → S3
Comment 1•26 days ago
|
||
Not an issue anymore. https://searchfox.org/comm-central/rev/59f3615b36c5ce10b1458e03aa5d68dae0e45d60/mailnews/imap/src/nsImapMailFolder.cpp#3830
Status: NEW → RESOLVED
Closed: 26 days ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•