PVS-StudioWarnings

PVS-Studio warning V522 for MTASA

Nov 20th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. void CGame::Packet_PlayerJoinData ( .... )
  2. {
  3.   ....
  4.   // Add the player
  5.   CPlayer* pPlayer = m_pPlayerManager->Create (....);
  6.   if ( pPlayer )
  7.   {
  8.     ....
  9.   }
  10.   else
  11.   {
  12.     // Tell the console
  13.     CLogger::LogPrintf(
  14.       "CONNECT: %s failed to connect "
  15.       "(Player Element Could not be created.)\n",
  16.       pPlayer->GetSourceIP() );
  17.   }
  18.   ....
  19. }
  20.  
  21. This suspicious code was found in MTASA project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V522 Dereferencing of the null pointer 'pPlayer' might take place. cgame.cpp 1895
  24.  
  25. 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