cec: fix segfault on exit
[deb_libcec.git] / src / lib / LibCEC.cpp
index 19f34ea3c8a468bad81af5c97f7a67138b91686b..87759c153926d5343a7e8cb0be3f12e76e1e7d97 100644 (file)
@@ -87,9 +87,17 @@ bool CLibCEC::Open(const char *strPort, int iTimeoutMs /* = 10000 */)
 void CLibCEC::Close(void)
 {
   if (m_cec)
+  {
     m_cec->StopThread();
+    delete m_cec;
+    m_cec = NULL;
+  }
   if (m_comm)
+  {
     m_comm->Close();
+    delete m_comm;
+    m_comm = NULL;
+  }
 }
 
 int CLibCEC::FindAdapters(std::vector<cec_adapter> &deviceList, const char *strDevicePath /* = NULL */)