1
1

rmaps/base: fix misc memory leaks

as reported by Coverity with CIDs 1196751, 1196754, 1196755 and 1269866
Этот коммит содержится в:
Gilles Gouaillardet 2015-03-02 13:59:48 +09:00
родитель d8f3b378b3
Коммит 456baeb71b
2 изменённых файлов: 6 добавлений и 5 удалений

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

@ -13,6 +13,8 @@
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -277,6 +279,7 @@ static int bind_downwards(orte_job_t *jdata,
locale = NULL;
if (!orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&locale, OPAL_PTR)) {
orte_show_help("help-orte-rmaps-base.txt", "rmaps:no-locale", true, ORTE_NAME_PRINT(&proc->name));
hwloc_bitmap_free(totalcpuset);
return ORTE_ERR_SILENT;
}
/* we don't know if the target is a direct child of this locale,
@ -674,7 +677,6 @@ int orte_rmaps_base_compute_bindings(orte_job_t *jdata)
int i, rc;
struct hwloc_topology_support *support;
bool force_down = false;
hwloc_cpuset_t totalcpuset;
int bind_depth, map_depth;
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
@ -829,7 +831,6 @@ int orte_rmaps_base_compute_bindings(orte_job_t *jdata)
*/
execute:
/* initialize */
totalcpuset = hwloc_bitmap_alloc();
for (i=0; i < jdata->map->nodes->size; i++) {
if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(jdata->map->nodes, i))) {
@ -853,7 +854,6 @@ int orte_rmaps_base_compute_bindings(orte_job_t *jdata)
continue;
}
orte_show_help("help-orte-rmaps-base.txt", "rmaps:cpubind-not-supported", true, node->name);
hwloc_bitmap_free(totalcpuset);
return ORTE_ERR_SILENT;
}
/* check if topology supports membind - have to be careful here
@ -872,7 +872,6 @@ int orte_rmaps_base_compute_bindings(orte_job_t *jdata)
membind_warned = true;
} else if (OPAL_HWLOC_BASE_MBFA_ERROR == opal_hwloc_base_mbfa) {
orte_show_help("help-orte-rmaps-base.txt", "rmaps:membind-not-supported-fatal", true, node->name);
hwloc_bitmap_free(totalcpuset);
return ORTE_ERR_SILENT;
}
}

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

@ -13,7 +13,7 @@
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* Copyright (c) 2014-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
@ -574,6 +574,7 @@ static int check_modifiers(char *ck, orte_mapping_policy_t *tmp)
if (NULL == (ptr = strchr(ck2[i], '='))) {
/* missing the value */
orte_show_help("help-orte-rmaps-base.txt", "missing-value", true, "pe", ck2[i]);
opal_argv_free(ck2);
return ORTE_ERR_SILENT;
}
ptr++;
@ -875,6 +876,7 @@ int orte_rmaps_base_set_ranking_policy(orte_ranking_policy_t *policy,
#endif
} else {
orte_show_help("help-orte-rmaps-base.txt", "unrecognized-policy", true, "ranking", rmaps_base_ranking_policy);
opal_argv_free(ck);
return ORTE_ERR_SILENT;
}
opal_argv_free(ck);