osaf/libs/agents/saf/imma/imma_oi_api.c |   9 +++++----
 osaf/libs/agents/saf/imma/imma_om_api.c |  17 ++++++++---------
 2 files changed, 13 insertions(+), 13 deletions(-)


Intialization of IMMA agent fails, then free the cl_node and changed the goto 
tag names.

diff --git a/osaf/libs/agents/saf/imma/imma_oi_api.c 
b/osaf/libs/agents/saf/imma/imma_oi_api.c
--- a/osaf/libs/agents/saf/imma/imma_oi_api.c
+++ b/osaf/libs/agents/saf/imma/imma_oi_api.c
@@ -2466,7 +2466,7 @@ SaAisErrorT saImmOiRtObjectUpdate_2(SaIm
                rc = SA_AIS_ERR_LIBRARY;
                /* Losing track of the pending reply count, but ERR_LIBRARY 
dominates*/
                TRACE_4("ERR_LIBRARY: Lock failed");
-               goto lock_fail1;
+               goto free_obj; /* locked will be false */
        }
        locked = true;
 
@@ -2474,7 +2474,7 @@ SaAisErrorT saImmOiRtObjectUpdate_2(SaIm
        if (!cl_node || cl_node->isOm) {
                rc = SA_AIS_ERR_BAD_HANDLE;
                TRACE_2("ERR_BAD_HANDLE: client_node_get failed");
-               goto lock_fail1;
+               goto bad_handle1;
        }
 
        imma_proc_decrement_pending_reply(cl_node, true);
@@ -2483,7 +2483,7 @@ SaAisErrorT saImmOiRtObjectUpdate_2(SaIm
                TRACE_1("Handle %llx is stale", immOiHandle);
                rc = SA_AIS_ERR_BAD_HANDLE;
                cl_node->exposed = true;
-               goto lock_fail1;
+               goto bad_handle1;
        }
 
        if (out_evt) {
@@ -2497,7 +2497,8 @@ SaAisErrorT saImmOiRtObjectUpdate_2(SaIm
 
  skip_over_send:
  bad_sync:
- lock_fail1:
+ bad_handle1:
+ free_obj:
        if (evt.info.immnd.info.objModify.objectName.buf) {     /*free-1 */
                free(evt.info.immnd.info.objModify.objectName.buf);
                evt.info.immnd.info.objModify.objectName.buf = NULL;
diff --git a/osaf/libs/agents/saf/imma/imma_om_api.c 
b/osaf/libs/agents/saf/imma/imma_om_api.c
--- a/osaf/libs/agents/saf/imma/imma_om_api.c
+++ b/osaf/libs/agents/saf/imma/imma_om_api.c
@@ -196,13 +196,13 @@ static SaAisErrorT initialize_common(SaI
        if (NCSCC_RC_SUCCESS != proc_rc) {
                TRACE_4("ERR_LIBRARY: imma startup failed:%u", proc_rc);
                rc = SA_AIS_ERR_LIBRARY;
-               goto lock_fail;
+               goto end;
        }
 
        if (false == cb->is_immnd_up) {
                TRACE_2("ERR_TRY_AGAIN: IMMND is DOWN");
                rc = SA_AIS_ERR_TRY_AGAIN;
-               goto lock_fail;
+               goto end;
        }
 
        if((timeout_env_value = getenv("IMMA_SYNCR_TIMEOUT"))!=NULL) {
@@ -219,7 +219,7 @@ static SaAisErrorT initialize_common(SaI
        if (m_NCS_LOCK(&cb->cb_lock, NCS_LOCK_WRITE) != NCSCC_RC_SUCCESS) {
                TRACE_4("ERR_LIBRARY: Lock failed");
                rc = SA_AIS_ERR_LIBRARY;
-               goto lock_fail;
+               goto end;
        }
        /* locked == true already */
 
@@ -376,12 +376,6 @@ static SaAisErrorT initialize_common(SaI
                imma_callback_ipc_destroy(cl_node);
 
  ipc_init_fail:
- lock_fail:
-       if (rc != SA_AIS_OK) {
-               free(cl_node);
-               cl_node=NULL;
-       }
-
        if (locked)
                m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE);
 
@@ -396,6 +390,7 @@ static SaAisErrorT initialize_common(SaI
                *immHandle = cl_node->handle;
        }
 
+ end:
        if (rc != SA_AIS_OK) {
                if (NCSCC_RC_SUCCESS != imma_shutdown(NCSMDS_SVC_ID_IMMA_OM)) {
                        /* Oh boy. Failure in imma_shutdown when we already have
@@ -404,6 +399,10 @@ static SaAisErrorT initialize_common(SaI
 
                        rc = SA_AIS_ERR_LIBRARY;
                }
+               if (cl_node){
+                       free(cl_node);
+                       cl_node=NULL;
+               }
        }
 
        TRACE_LEAVE();

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to