Skip to content

Commit

Permalink
Fixing a memory issue in tsk_treeseq_update_branch_afs
Browse files Browse the repository at this point in the history
  • Loading branch information
tforest committed Oct 31, 2024
1 parent c9f6c06 commit 59ea266
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion c/tskit/trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -3543,14 +3543,15 @@ tsk_treeseq_update_branch_afs(const tsk_treeseq_t *self, tsk_id_t u, double righ
const double *count_row = GET_2D_ROW(counts, num_sample_sets + 1, u);
/* double x = (right - last_update[u]) * branch_length[u]; */
double x = 0;
double t_v = time[parent[u]];
double t_v = 0;
double tw_branch_length = 0;
const tsk_size_t all_samples = (tsk_size_t) count_row[num_sample_sets];
if (coordinate == NULL) {
ret = TSK_ERR_NO_MEMORY;
goto out;
}
if (parent[u] != -1){
t_v = time[parent[u]];
if (0 < all_samples && all_samples < self->num_samples) {
for (time_window_index = 0; time_window_index < num_time_windows; time_window_index++){
afs_size = result_dims[num_sample_sets];
Expand Down

0 comments on commit 59ea266

Please sign in to comment.