Skip to content

Commit de82c31

Browse files
committed
haplotypes_phase needs to be set to NULL if not initialized
1 parent 3f6a327 commit de82c31

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

snp2h5/snp2h5.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,14 +1169,16 @@ void parse_vcf(Arguments *args, Chromosome *all_chroms, int n_chrom,
11691169
vcf->sample_names, vcf->n_sample);
11701170
sample_tab_free(samp_tab);
11711171

1172-
/* initialize the phase matrix */
1173-
haplotypes_phase = my_malloc(vcf->n_sample * sizeof(char));
1174-
init_h5matrix(&haplotype_phase_info, haplotype_info->n_row,
1175-
vcf->n_sample,
1176-
HAPLOTYPE_DATATYPE, util_str_concat("phase_", chrom->name, NULL));
1172+
/* initialize the phase matrix */
1173+
haplotypes_phase = my_malloc(vcf->n_sample * sizeof(char));
1174+
init_h5matrix(&haplotype_phase_info, haplotype_info->n_row,
1175+
vcf->n_sample,
1176+
HAPLOTYPE_DATATYPE,
1177+
util_str_concat("phase_", chrom->name, NULL));
11771178
}
11781179
} else {
11791180
haplotypes = NULL;
1181+
haplotypes_phase = NULL;
11801182
}
11811183
if(args->snp_index_file) {
11821184
/* SNP index vector is same length as chromosome,

0 commit comments

Comments
 (0)