Skip to content

Commit

Permalink
Fixed minor bug when freeing msa...
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoLassmann committed Nov 5, 2022
1 parent 7b52bc5 commit e5c880c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/src/msa_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ void kalign_free_msa(struct msa* msa)
int i;
if(msa){
for(i = 0; i < msa->alloc_numseq;i++){
free_msa_seq(msa->sequences[i]);
if(msa->sequences[i]){
free_msa_seq(msa->sequences[i]);
}
}

for (i = msa->num_profiles;i--;){
Expand Down
15 changes: 12 additions & 3 deletions lib/src/msa_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ int kalign_essential_input_check(struct msa *msa, int exit_on_error)
ASSERT(msa->numseq > 1,"only %d sequences found.", msa->numseq);
for(int i = 0; i < msa->numseq;i++){
if(msa->sequences[i]->len == 0){
WARNING_MSG("No sequence found for sequence %s ",msa->sequences[i]->name);
if(!msa->quiet){
WARNING_MSG("No sequence found for sequence %s ",msa->sequences[i]->name);
}
problem_len0++;
}
}
Expand All @@ -78,9 +80,13 @@ int kalign_essential_input_check(struct msa *msa, int exit_on_error)


if(problem_len0 == 1){
LOG_MSG("Removing %d sequence with a length of 0.", problem_len0);
if(!msa->quiet){
LOG_MSG("Removing %d sequence with a length of 0.", problem_len0);
}
}else{
LOG_MSG("Removing %d sequences with a length of 0.",problem_len0);
if(!msa->quiet){
LOG_MSG("Removing %d sequences with a length of 0.",problem_len0);
}
}

struct msa_seq** tmp = NULL;
Expand All @@ -97,6 +103,9 @@ int kalign_essential_input_check(struct msa *msa, int exit_on_error)
e--;
}
}
for(int i = msa->numseq; i < msa->alloc_numseq;i++){
tmp[i] = NULL;
}

MFREE(msa->sequences);
msa->sequences = tmp;
Expand Down

0 comments on commit e5c880c

Please sign in to comment.