Advertisement
PVS-StudioWarnings

PVS-Studio warning V595 for Asterisk

Nov 21st, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. static void sorcery_object_wizard_destructor(void *obj)
  2. {
  3.   struct ast_sorcery_object_wizard *object_wizard = obj;
  4.  
  5.   if (object_wizard->data) {
  6.     object_wizard->wizard->close(object_wizard->data);      //<==
  7.   }
  8.  
  9.   if (object_wizard->wizard) {                              //<==
  10.     ast_module_unref(object_wizard->wizard->module);
  11.   }
  12.  
  13.   ao2_cleanup(object_wizard->wizard);                       //<==
  14. }
  15.  
  16. This suspicious code was found in Asterisk project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V595 The 'object_wizard->wizard' pointer was utilized before it was verified against nullptr. Check lines: 683, 686. sorcery.c 683
  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
Advertisement