From 46166a9c774d9018cf32241459b0891c3c9ae330 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 24 Oct 2006 22:06:18 +0000 Subject: [PATCH] Fix a bug that would cause a segfault when someone specified an option that had no corresponding value This commit was SVN r12288. --- orte/mca/rmaps/base/rmaps_base_registry_fns.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/orte/mca/rmaps/base/rmaps_base_registry_fns.c b/orte/mca/rmaps/base/rmaps_base_registry_fns.c index 235a351dc9..d5707949a1 100644 --- a/orte/mca/rmaps/base/rmaps_base_registry_fns.c +++ b/orte/mca/rmaps/base/rmaps_base_registry_fns.c @@ -463,11 +463,20 @@ int orte_rmaps_base_store_mapping_plan(orte_jobid_t job, opal_list_t *attr_list) /* copy the data that is to be stored */ for (i=0, j=0; i < num_attrs_defd; i++) { if (NULL != (attr = orte_rmgr.find_attribute(attr_list, attrs[i]))) { - if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[j]), attr->key, - attr->value->type, attr->value->data))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(value); - return rc; + if (NULL != attr->value) { + if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[j]), attr->key, + attr->value->type, attr->value->data))) { + ORTE_ERROR_LOG(rc); + OBJ_RELEASE(value); + return rc; + } + } else { + if (ORTE_SUCCESS != (rc = orte_gpr.create_keyval(&(value->keyvals[j]), attr->key, + ORTE_UNDEF, NULL))) { + ORTE_ERROR_LOG(rc); + OBJ_RELEASE(value); + return rc; + } } j++; }