This ticket address the issue in IMM agent init.
IMM agent alway got the SA_AIS_ERR_LIBRARY event
if IMM has started successfully.

This fix is destroy lib_req when leap startup fail
---
 src/base/ncs_main_pub.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/base/ncs_main_pub.c b/src/base/ncs_main_pub.c
index d85dc6b47..f71ff36bb 100644
--- a/src/base/ncs_main_pub.c
+++ b/src/base/ncs_main_pub.c
@@ -159,9 +159,8 @@ unsigned int ncs_leap_startup(void)
        }
 
        if (sprr_lib_req(&lib_create) != NCSCC_RC_SUCCESS) {
-               TRACE_4("\nERROR: SPRR lib_req failed \n");
-               osaf_mutex_unlock_ordie(&s_agent_startup_mutex);
-               return NCSCC_RC_FAILURE;
+               TRACE_4("\nERROR: SPRR lib_req NCS_LIB_REQ_CREATE failed \n");
+               goto lib_req_fail;
        }
 
        /* Get & Update system specific arguments */
@@ -180,6 +179,18 @@ unsigned int ncs_leap_startup(void)
        gl_ncs_main_pub_cb.lib_hdl = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
 
        return NCSCC_RC_SUCCESS;
+
+lib_req_fail:
+       leap_env_destroy();
+       NCS_LIB_REQ_INFO lib_destroy;
+
+       memset(&lib_destroy, 0, sizeof(lib_destroy));
+       lib_destroy.i_op = NCS_LIB_REQ_DESTROY;
+       lib_destroy.info.destroy.dummy = 0;
+       if (sprr_lib_req(&lib_destroy) != NCSCC_RC_SUCCESS)
+               TRACE_4("\nERROR: SPRR lib_req NCS_LIB_REQ_DESTROY failed\n");
+       osaf_mutex_unlock_ordie(&s_agent_startup_mutex);
+       return NCSCC_RC_FAILURE;
 }
 
 /***************************************************************************\
-- 
2.25.1



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to