Fix HAN issues reported by Coverity.
Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
Этот коммит содержится в:
родитель
1264b672fd
Коммит
9d4e3b1649
@ -439,6 +439,12 @@ static opal_list_t *check_components(opal_list_t * components,
|
||||
/* If we didn't find any available components, return an error */
|
||||
if (0 == opal_list_get_size(selectable)) {
|
||||
OBJ_RELEASE(selectable);
|
||||
if( NULL != coll_exclude ) {
|
||||
free(coll_exclude);
|
||||
}
|
||||
if( NULL != coll_include ) {
|
||||
free(coll_include);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -551,10 +551,10 @@ static const char* colltype_translation_table[] = {
|
||||
[COLLCOUNT] = NULL
|
||||
};
|
||||
|
||||
char* mca_coll_base_colltype_to_str(int collid)
|
||||
const char* mca_coll_base_colltype_to_str(int collid)
|
||||
{
|
||||
if( (collid < 0) || (collid >= COLLCOUNT) ) {
|
||||
return NULL;
|
||||
}
|
||||
return strdup(colltype_translation_table[collid]);
|
||||
return colltype_translation_table[collid];
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ int ompi_coll_base_file_getnext_string(FILE *fptr, int *fileline, char** val);
|
||||
int ompi_coll_base_file_peek_next_char_is(FILE *fptr, int *fileline, int expected);
|
||||
|
||||
/* Miscelaneous function */
|
||||
char* mca_coll_base_colltype_to_str(int collid);
|
||||
const char* mca_coll_base_colltype_to_str(int collid);
|
||||
int mca_coll_base_name_to_colltype(const char* name);
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -130,7 +130,7 @@ mca_coll_han_init_dynamic_rules(void)
|
||||
/* maybe the file was in the old format and we read the collective index instead of the name. */
|
||||
char* endp;
|
||||
coll_id = strtol(coll_name, &endp, 10);
|
||||
if( '\0' != *endp ) { /* there is garbage in the input */
|
||||
if( ('\0' != *endp ) || (coll_id < ALLGATHER) || (coll_id >= COLLCOUNT) ) { /* there is garbage in the input */
|
||||
opal_output_verbose(5, mca_coll_han_component.han_output,
|
||||
"coll:han:mca_coll_han_init_dynamic_rules invalid collective %s "
|
||||
"at line %d: the collective must be at least %d and less than %d. "
|
||||
@ -138,8 +138,10 @@ mca_coll_han_init_dynamic_rules(void)
|
||||
coll_name, fileline, ALLGATHER, COLLCOUNT);
|
||||
goto file_reading_error;
|
||||
}
|
||||
free(coll_name);
|
||||
coll_name = mca_coll_base_colltype_to_str(coll_id);
|
||||
if( NULL != coll_name ) {
|
||||
free(coll_name);
|
||||
}
|
||||
coll_name = strdup(mca_coll_base_colltype_to_str(coll_id));
|
||||
}
|
||||
|
||||
if(!mca_coll_han_is_coll_dynamic_implemented(coll_id)) {
|
||||
@ -390,24 +392,26 @@ cannot_allocate:
|
||||
opal_output_verbose(0, mca_coll_han_component.han_output,
|
||||
"coll:han:mca_coll_han_init_dynamic_rules "
|
||||
"cannot allocate dynamic rules\n");
|
||||
/* Do not check free_dynamic_rules
|
||||
* because we are returning OMPI_ERROR anyway */
|
||||
if( NULL != coll_name ) {
|
||||
free(coll_name);
|
||||
}
|
||||
fclose (fptr);
|
||||
/* We disable the module, we don't need to keep the rules */
|
||||
mca_coll_han_free_dynamic_rules();
|
||||
return OMPI_ERROR;
|
||||
|
||||
file_reading_error:
|
||||
if( NULL != coll_name ) {
|
||||
free(coll_name);
|
||||
}
|
||||
opal_output_verbose(0, mca_coll_han_component.han_output,
|
||||
"coll:han:mca_coll_han_init_dynamic_rules "
|
||||
"could not fully read dynamic rules file. "
|
||||
"Will use mca parameters defined rules. "
|
||||
"To see error detail, please set "
|
||||
"collective verbosity level over 5\n");
|
||||
if(fptr) {
|
||||
fclose (fptr);
|
||||
if( NULL != coll_name ) {
|
||||
free(coll_name);
|
||||
}
|
||||
fclose (fptr);
|
||||
/* We disable the module, we don't need to keep the rules */
|
||||
mca_coll_han_free_dynamic_rules();
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user