PVS-StudioWarnings

PVS-Studio warning V522 for NetXMS

Nov 19th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. void ClientSession::findIpAddress(CSCPMessage *request)
  2. {
  3.   ....
  4.   if (subnet != NULL)
  5.   {
  6.     debugPrintf(5, _T("findIpAddress(%s): found subnet %s"),
  7.                 ipAddrText,
  8.                 subnet->Name());
  9.     found = subnet->findMacAddress(ipAddr, macAddr);
  10.   }
  11.   else
  12.   {
  13.     debugPrintf(5, _T("findIpAddress(%s): subnet not found"),
  14.                 ipAddrText,
  15.                 subnet->Name());
  16.   }
  17.   ....
  18. }
  19.  
  20. This suspicious code was found in NetXMS project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V522 Dereferencing of the null pointer 'subnet' might take place. session.cpp 10823
  23.  
  24. 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