PC-Lint warnings fixed:
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Tue, 3 Jan 2012 09:47:02 +0000 (07:47 -0200)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Tue, 3 Jan 2012 09:47:02 +0000 (07:47 -0200)
- Warning 1551: Function may throw exception '...' in destructor 'NetworkInterfaceList::~NetworkInterfaceList(void)';
- Info 1775: catch block does not catch any declared exception.

src/host/networkinterfacelist.cpp

index 4eb33b1..f766559 100644 (file)
@@ -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;
 }