diff --git a/orte/mca/gpr/replica/communications/gpr_replica_put_get_cm.c b/orte/mca/gpr/replica/communications/gpr_replica_put_get_cm.c index 2c33f5debf..712c671b45 100644 --- a/orte/mca/gpr/replica/communications/gpr_replica_put_get_cm.c +++ b/orte/mca/gpr/replica/communications/gpr_replica_put_get_cm.c @@ -497,12 +497,22 @@ int orte_gpr_replica_recv_get_conditional_cmd(orte_buffer_t *input_buffer, free(values); } - for (i=0; i < num_conditions; i++) { - if (NULL != conds[i]) OBJ_RELEASE(conds[i]); - if (NULL != conditions[i]) OBJ_RELEASE(conditions[i]); + if (NULL != conds) { + for (i=0; i < num_conditions; i++) { + if (NULL != conds[i]) { + OBJ_RELEASE(conds[i]); + } + } + free(conds); + } + if (NULL != conditions) { + for (i=0; i < num_conditions; i++) { + if (NULL != conditions[i]) { + OBJ_RELEASE(conditions[i]); + } + } + free(conditions); } - if (NULL != conds) free(conds); - if (NULL != conditions) free(conditions); /* pack response code */ if (ORTE_SUCCESS != (rc = orte_dps.pack(output_buffer, &ret, 1, ORTE_INT))) {