1
1

We have a goto label for cleanup so make sure we always use it. This way we insure

that the lock are correctly released in all cases.

This commit was SVN r14925.
Этот коммит содержится в:
George Bosilca 2007-06-06 20:20:52 +00:00
родитель 28c9d0758b
Коммит 24eae5c1ec

Просмотреть файл

@ -60,25 +60,20 @@ int orte_gpr_replica_put(orte_std_cntr_t cnt, orte_gpr_value_t **values)
/* first check for error - all keyvals must have a non-NULL string key */
for (j=0; j < val->cnt; j++) {
if (NULL == (val->keyvals[j])->key) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex);
return ORTE_ERR_BAD_PARAM;
rc = ORTE_ERR_BAD_PARAM;
goto CLEANUP;
}
}
/* find the segment */
if (ORTE_SUCCESS != (rc = orte_gpr_replica_find_seg(&seg, true, val->segment))) {
ORTE_ERROR_LOG(rc);
OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex);
return rc;
goto CLEANUP;
}
/* convert tokens to array of itags */
if (ORTE_SUCCESS != (rc = orte_gpr_replica_get_itag_list(&itags, seg,
val->tokens, &(val->num_tokens)))) {
ORTE_ERROR_LOG(rc);
OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex);
return rc;
val->tokens, &(val->num_tokens)))) {
goto CLEANUP;
}
if (ORTE_SUCCESS != (rc = orte_gpr_replica_put_fn(val->addr_mode, seg, itags, val->num_tokens,
@ -87,17 +82,16 @@ int orte_gpr_replica_put(orte_std_cntr_t cnt, orte_gpr_value_t **values)
}
if (ORTE_SUCCESS != (rc = orte_gpr_replica_check_events())) {
ORTE_ERROR_LOG(rc);
goto CLEANUP;
}
if (NULL != itags) {
free(itags);
itags = NULL;
}
itags = NULL;
}
CLEANUP:
CLEANUP: /* or not ... */
/* release list of itags */
if (NULL != itags) {
free(itags);
@ -105,12 +99,13 @@ CLEANUP:
if (ORTE_SUCCESS == rc) {
rc = orte_gpr_replica_process_callbacks();
} else {
ORTE_ERROR_LOG(rc);
}
OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex);
return rc;
}