Advertisement
PVS-StudioWarnings

PVS-Studio warning V595 for Firefox

Nov 24th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.10 KB | None | 0 0
  1. nsresult
  2. ShortcutResolver::Init()
  3. {
  4.     CoInitialize(NULL);  // FIX: we should probably move
  5.                          // somewhere higher up during startup
  6.  
  7.     HRESULT hres;
  8.     hres = CoCreateInstance(CLSID_ShellLink,
  9.                             NULL,
  10.                             CLSCTX_INPROC_SERVER,
  11.                             IID_IShellLinkW,
  12.                             (void**)&(mShellLink));
  13.     if (SUCCEEDED(hres))
  14.     {
  15.         // Get a pointer to the IPersistFile interface.
  16.         hres = mShellLink->QueryInterface(
  17.           IID_IPersistFile, (void**)&mPersistFile);
  18.     }
  19.  
  20.     if (mPersistFile == nsnull || mShellLink == nsnull)
  21.         return NS_ERROR_FAILURE;
  22.  
  23.     return NS_OK;
  24. }
  25.  
  26. This suspicious code was found in Firefox project by PVS-Studio static code analyzer.
  27. Warning message is:
  28. V595 The 'mShellLink' pointer was utilized before it was verified against nullptr. Check lines: 183, 187. nslocalfilewin.cpp 183
  29.  
  30. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement