Closed iqbal-lab closed 8 years ago
Actually, given the mask is an array of length NUM_SPECIES of booleans, we are basically talking about ~50 bools. Maybe at worst 200 booleans, right? I'd be tempted to do it on the stack. Not a big deal either way. The other option is to change code from
Species get_best_MTBC_species(SpeciesInfo* species_info ){ boolean* mask = create_MTBC_mask(); int species_enum = get_best_hit(species_info->species_covg_info,mask); Species species = species_enum; return (species); }
to
Species get_best_MTBC_species(SpeciesInfo* species_info ){ boolean* mask = create_MTBC_mask(); int species_enum = get_best_hit(species_info->species_covg_info,mask); free(mask); Species species = species_enum; return (species); }
OK, in all cases the fix is very simple - leaving this to fix after ECCMOD
Phelim, is this still open?
I think so. Will take a look on dev and fix before merging to master.
eg this in base_species.c
boolean* create_mask(boolean default_value) { boolean* mask = malloc(NUM_SPECIES * sizeof(boolean));
Should check afterwards eg
if (mask==NULL) { fail or return error message }
Ties into bigger picture of improving error handling being passed back to app