]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3991] catch all exceptions in destructor
authorRazvan Becheriu <razvan@isc.org>
Wed, 27 May 2026 16:29:26 +0000 (19:29 +0300)
committerFrancis Dupont <fdupont@isc.org>
Wed, 27 May 2026 20:03:02 +0000 (22:03 +0200)
src/lib/asiolink/unix_domain_socket.cc
src/lib/util/unlock_guard.h

index 18c1f48a05437935d33dfeeeef8240dce61f7008..7b365eeb74eab7944c898211257599a8dc041822 100644 (file)
@@ -32,9 +32,12 @@ public:
     /// @brief Destructor.
     ///
     /// Closes the socket.
-    // cppcheck-suppress throwInNoexceptFunction
     ~UnixDomainSocketImpl() {
-        close();
+        try {
+            close();
+        } catch (...) {
+            // catch all exceptions.
+        }
     }
 
     /// @brief Asynchronously connects to an endpoint.
index 5cb49fc9784c9b34cf447e442c2644d3e0c7adea..8d202250594b0d09f1acdf323bffd889df808f6c 100644 (file)
@@ -32,9 +32,12 @@ public:
     /// @brief Destructor.
     ///
     /// Lock mutex object on destructor.
-    // cppcheck-suppress throwInNoexceptFunction
     ~UnlockGuard() {
-        lock_.lock();
+        try {
+            lock_.lock();
+        } catch (...) {
+            // catch all exceptions.
+        }
     }
 
 private: