PVS-StudioWarnings

PVS-Studio warning V522 for DDKSamples

Nov 19th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. HRESULT CSensorDDI::OnGetDataFields(....)
  2. {
  3.   ....
  4.   if (nullptr != pSensor)
  5.   {
  6.     ....
  7.   }
  8.   else
  9.   {
  10.     hr = E_POINTER;
  11.     Trace(TRACE_LEVEL_ERROR,
  12.       "pSensor == NULL before getting datafield %!GUID!-%i "
  13.       "value from %s, hr = %!HRESULT!",
  14.       &Key.fmtid, Key.pid, pSensor->m_SensorName, hr);
  15.   }
  16. }
  17.  
  18. This suspicious code was found in DDKSamples project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V522 Dereferencing of the null pointer 'pSensor' might take place. sensorddi.cpp 903
  21.  
  22. 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