From: Guilherme Maciel Ferreira Date: Tue, 3 Jan 2012 09:47:02 +0000 (-0200) Subject: PC-Lint warnings fixed: X-Git-Tag: v1.3~19 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=a0d37a2d1d1bbb9aad8fe1e26ba90281503c7df0;p=pingcheck PC-Lint warnings fixed: - Warning 1551: Function may throw exception '...' in destructor 'NetworkInterfaceList::~NetworkInterfaceList(void)'; - Info 1775: catch block does not catch any declared exception. --- diff --git a/src/host/networkinterfacelist.cpp b/src/host/networkinterfacelist.cpp index 4eb33b1..f766559 100644 --- a/src/host/networkinterfacelist.cpp +++ b/src/host/networkinterfacelist.cpp @@ -47,9 +47,16 @@ NetworkInterfaceList::NetworkInterfaceList() : */ NetworkInterfaceList::~NetworkInterfaceList() { - if ( initialized() ) + try { + if ( initialized() ) + { + destroy_list(); + } + } + catch ( ... ) { - destroy_list(); + GlobalLogger.error() << "Error: could not destroy network interface list." + << endl; } } //lint !e1579 @@ -131,16 +138,9 @@ void NetworkInterfaceList::destroy_list() { BOOST_ASSERT( IfaFirst != NULL ); - try { - // The freeifaddrs() must release the linked list allocated by getifaddrs() - freeifaddrs( IfaFirst ); - IfaFirst = NULL; - } - catch ( ... ) - { - GlobalLogger.error() << "Error: could not destroy network interface list." - << endl; - } + // The freeifaddrs() must release the linked list allocated by getifaddrs() + freeifaddrs( IfaFirst ); + IfaFirst = NULL; }