host-bmc: free instance ID on request registration failure

getHostPDR() allocates an instance ID before calling
registerRequest() to queue a PLDM request. If
registerRequest() fails, the allocated instance ID
remains allocated until it expires from the InstanceIdDb.

Release the allocated instance ID when registerRequest()
fails, matching the cleanup already performed when
encode_get_pdr_req() fails. This keeps instance ID handling
consistent across error paths and avoids retaining an
unneeded instance ID until expiration.

No functional change to the successful GetPDR request path.

Change-Id: I99f707ef02f096ed1e08d922e18da99b31d43e4f
Signed-off-by: Meghana Vangapandu <meghanav@ami.com>
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index c249d7a..647c671 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -238,6 +238,7 @@
         });
     if (rc)
     {
+        instanceIdDb.free(mctp_eid, instanceId);
         error(
             "Failed to send the getPDR request to remote terminus, response code '{RC}'",
             "RC", rc);