pldmd: fix creation of HostEffecterParser object

Change-Id: If3da922dadcbacbd1e02ce11632c9e19179463e3
Signed-off-by: Sampa Misra <sampmisr@in.ibm.com>
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index fa1c89c..a688b86 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -171,16 +171,19 @@
     auto& bus = pldm::utils::DBusHandler::getBus();
     dbus_api::Requester dbusImplReq(bus, "/xyz/openbmc_project/pldm");
     std::unique_ptr<HostPDRHandler> hostPDRHandler;
+    std::unique_ptr<pldm::host_effecters::HostEffecterParser>
+        hostEffecterParser;
+    DBusHandler dbusHandler;
     auto hostEID = pldm::utils::readHostEID();
     if (hostEID)
     {
         hostPDRHandler = std::make_unique<HostPDRHandler>(
             sockfd, hostEID, event, pdrRepo.get(), entityTree.get(),
             dbusImplReq);
-        DBusHandler dbusHandler;
-        pldm::host_effecters::HostEffecterParser hostEffecterParser(
-            &dbusImplReq, sockfd, pdrRepo.get(), &dbusHandler, HOST_JSONS_DIR,
-            verbose);
+        hostEffecterParser =
+            std::make_unique<pldm::host_effecters::HostEffecterParser>(
+                &dbusImplReq, sockfd, pdrRepo.get(), &dbusHandler,
+                HOST_JSONS_DIR, verbose);
     }
 
     Invoker invoker{};