Fix static analysis issues 07/307907/2 accepted/tizen/unified/20240315.111204 accepted/tizen/unified/20240315.155129 accepted/tizen/unified/x/20240319.055410
authorTomasz Swierczek <t.swierczek@samsung.com>
Thu, 14 Mar 2024 06:31:09 +0000 (07:31 +0100)
committerTomasz Swierczek <t.swierczek@samsung.com>
Thu, 14 Mar 2024 09:12:35 +0000 (10:12 +0100)
* Initialize missing fields of Tunnel & Bluetooth classes
* Add missing virtual destructor of IEnctyptedTunnel

Change-Id: I06e14167b4646897d2c2a382960d0fd9332d222d

srcs/bluetooth_advert.h
srcs/encrypted_tunnel.h
srcs/tunnel.cpp

index e7c3c766ac9ee65859b8303e1cbaa6d0a887368d..40b9620d081345dab2d24947eec5e6d0169a3a2d 100644 (file)
@@ -110,7 +110,7 @@ private:
         Starting,
         Awaiting,
     } m_scanState = ScanState::NotInProgress;
-    guint m_scanCancellationCallbackId;
+    guint m_scanCancellationCallbackId = 0;
     std::mutex m_scanMutex;
 
     CallbackType m_scanCallback = nullptr;         // used only in the main thread
index a46cd34a72390e0ed4dfe12b4212a186647bc4e0..0f31c952e692cd95a86b07811dae4fa88ba9a95b 100644 (file)
@@ -30,6 +30,9 @@ public:
 
     // May be called from the other thread.
     virtual void Cancel() = 0;
+
+    // Needed as derived classes are handled with pointers to this interface
+    virtual ~IEncryptedTunnel(){};
 };
 
 class EncryptedTunnel : public IEncryptedTunnel {
index e27c2a8231cbafafbeb7e191d29edd11c0dd320b..3b2c44d52f8ace5087931f903e6943ad1572b0d0 100644 (file)
@@ -88,6 +88,7 @@ Tunnel::Tunnel(std::shared_ptr<IWebsockets> ws)
 : m_ws(ws),
   m_context(nullptr),
   m_connection(nullptr),
+  m_writtenBytesNum(0),
   m_state(State::DISCONNECTED),
   m_cancelled(false)
 {