Skip to content

Commit dcf6307

Browse files
devrealFlorentGermain-Bull
authored andcommitted
Properly free variables in coll_han_dynamic_file
Fixes CIDs 1516453, 1516452, and 1516451. Signed-off-by: Joseph Schuchart <[email protected]> (cherry picked from commit 9e558f8)
1 parent 8b0e609 commit dcf6307

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ompi/mca/coll/han/coll_han_dynamic_file.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ mca_coll_han_init_dynamic_rules(void)
226226
"coll:han:mca_coll_han_init_dynamic_rules found an error on dynamic rules file %s "
227227
"at line %d: unknown topo level '%s'\n",
228228
fname, fileline, topo_lvl_name);
229+
free(topo_lvl_name);
230+
topo_lvl_name = NULL;
229231
goto file_reading_error;
230232
}
231233
}
@@ -352,6 +354,7 @@ mca_coll_han_init_dynamic_rules(void)
352354
"least %d and less than %d\n",
353355
fname, fileline, target_comp_name, SELF, COMPONENTS_COUNT);
354356
free(target_comp_name);
357+
target_comp_name = NULL;
355358
goto file_reading_error;
356359
}
357360

@@ -364,17 +367,23 @@ mca_coll_han_init_dynamic_rules(void)
364367
"coll:han:mca_coll_han_init_dynamic_rules found an error on dynamic rules file %s "
365368
"at line %d: cannot read the name/id of an algorithm\n",
366369
fname, fileline);
370+
free(target_comp_name);
371+
target_comp_name = NULL;
367372
goto file_reading_error;
368373
}
369374
algorithm_id = mca_coll_han_algorithm_name_to_id(coll_id, algorithm_name);
370375
if (algorithm_id < 0) {
371376
char *endp;
372377
algorithm_id = (int)strtol(algorithm_name, &endp, 10);
378+
free(algorithm_name);
379+
algorithm_name = NULL;
373380
if (('\0' != *endp ) || !mca_coll_han_algorithm_id_is_valid(coll_id, algorithm_id)) {
374381
opal_output_verbose(5, mca_coll_han_component.han_output,
375382
"coll:han:mca_coll_han_init_dynamic_rules found an error on dynamic rules file %s "
376383
"at line %d: unknown algorithm '%s' for %s\n",
377384
fname, fileline, algorithm_name, coll_name);
385+
free(target_comp_name);
386+
target_comp_name = NULL;
378387
goto file_reading_error;
379388
}
380389
}

0 commit comments

Comments
 (0)