PVS-StudioWarnings

PVS-Studio warning V581 for Asterisk

Nov 19th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. static void sip_threadinfo_destructor(void *obj)
  2. {
  3.   struct sip_threadinfo *th = obj;
  4.   struct tcptls_packet *packet;
  5.  
  6.   if (th->alert_pipe[1] > -1) {            //<==
  7.     close(th->alert_pipe[0]);
  8.   }
  9.   if (th->alert_pipe[1] > -1) {
  10.     close(th->alert_pipe[1]);
  11.   }
  12.   th->alert_pipe[0] = th->alert_pipe[1] = -1;
  13.   ....
  14. }
  15.  
  16. This suspicious code was found in Asterisk project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V581 The conditional expressions of the 'if' operators situated alongside each other are identical. Check lines: 2513, 2516. chan_sip.c 2516
  19.  
  20. 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