Skip to content

Commit

Permalink
Fix memory allocation statements
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjcroucher committed Apr 20, 2024
1 parent 16ae012 commit fdb338e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Newickform.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ newick_node* build_newick_tree(char * filename, FILE *vcf_file_pointer,int * snp
// Allocate memory to store all sequences
// N.B. this can be reduced once memory management improves
int num_stored_nodes = num_nodes;
char ** node_sequences = (char **) calloc((number_of_snps + 1)*num_stored_nodes,sizeof(char));
char ** node_names = (char **) calloc(MAX_SAMPLE_NAME_SIZE*num_stored_nodes,sizeof(char));
char ** node_sequences = calloc((number_of_snps + 1) * num_stored_nodes, sizeof(char*));
char ** node_names = calloc(MAX_SAMPLE_NAME_SIZE*num_stored_nodes,sizeof(char));

for (int seq_store_index = 0; seq_store_index < num_stored_nodes; ++seq_store_index)
{
node_names[seq_store_index] = " ";
Expand Down

0 comments on commit fdb338e

Please sign in to comment.