Remove hostConsole fd from the event loop.

The fd is registered in the sd_event_loop, so as part of cleanup of
the customFD the fd is removed from the event loop.

Change-Id: Idfc07375ae330c82755fb1d08c8f181410cf917f
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp
index ce0e5a4..8afc932 100644
--- a/sol/sol_manager.cpp
+++ b/sol/sol_manager.cpp
@@ -12,6 +12,16 @@
 
 using namespace phosphor::logging;
 
+CustomFD::~CustomFD()
+{
+    if(fd >= 0)
+    {
+        // Remove the host console descriptor from the sd_event_loop
+        std::get<eventloop::EventLoop&>(singletonPool).stopHostConsole();
+        close(fd);
+    }
+}
+
 void Manager::initHostConsoleFd()
 {
     struct sockaddr_un addr;
@@ -127,8 +137,6 @@
 
     if (payloadMap.empty())
     {
-        // Remove the host console decriptor from the sd_event_loop
-        std::get<eventloop::EventLoop&>(singletonPool).stopHostConsole();
         consoleFD.reset();
     }
 }