PVS-StudioWarnings

PVS-Studio warning V561 for VirtualBox

Nov 13th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. static NTSTATUS APIENTRY
  2. DxgkDdiRenderNew(CONST HANDLE hContext, DXGKARG_RENDER  *pRender)
  3. {
  4.   ....
  5.   NTSTATUS Status = STATUS_SUCCESS;    //<==
  6.  
  7.   __try
  8.   {
  9.     ....
  10.     NTSTATUS Status = STATUS_SUCCESS;  //<==
  11.     ....
  12.   }
  13.   __except (EXCEPTION_EXECUTE_HANDLER)
  14.   {
  15.     Status = STATUS_INVALID_PARAMETER;
  16.     WARN(("invalid parameter"));
  17.   }
  18.  
  19.   return Status;
  20. }
  21.  
  22. Any change of the variable within the try..except section won't change the returned value and the external (in relation to the try {} block) variable will be changed only if an exception occurs.
  23.  
  24. This suspicious code was found in VirtualBox project by PVS-Studio static code analyzer.
  25. Warning message is:
  26. V561 It's probably better to assign value to 'Status' variable than to declare it anew. Previous declaration: vboxmpwddm.cpp, line 5723. vboxmpwddm.cpp 5728
  27.  
  28. 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