fix memory leak

This commit is contained in:
chhylp123
2021-02-13 23:58:39 -05:00
parent 18086e2c2e
commit 02fa015e28
3 changed files with 22 additions and 6 deletions
+2 -2
View File
@@ -11601,7 +11601,6 @@ void init_hc_links(hc_links* link, uint64_t ug_num, uint64_t r_num)
{
kv_init(link->bed.a[i]);
}
}
void destory_hc_links(hc_links* link)
@@ -11619,6 +11618,7 @@ void destory_hc_links(hc_links* link)
kv_destroy(link->bed.a[i]);
}
kv_destroy(link->bed);
kv_destroy(link->enzymes);
}
void pop_small_bub(ma_ug_t *ug)
@@ -11855,7 +11855,7 @@ R_to_U* ruIndex, float chimeric_rate, float drop_ratio, int max_hang, int min_ov
ma_ug_destroy(ug);
kv_destroy(new_rtg_edges.a);
///output_unitig_graph(sg, coverage_cut, output_file_name, sources, ruIndex, max_hang, min_ovlp);
output_unitig_graph(sg, coverage_cut, output_file_name, sources, ruIndex, max_hang, min_ovlp);
output_trio_unitig_graph(sg, coverage_cut, output_file_name, FATHER, sources,
reverse_sources, bubble_dist, (asm_opt.max_short_tip*2), 0.15, 3, ruIndex,
0.05, 0.9, max_hang, min_ovlp, 0);
+5 -4
View File
@@ -444,7 +444,7 @@ void hc_pt_t_gen_single(hc_pt1_t* pt, uint64_t* up_bound)
int write_hc_pt_index(ha_ug_index* idx, char* file_name)
{
char* gfa_name = (char*)malloc(strlen(file_name)+25);
sprintf(gfa_name, "%s.hc_tlb", file_name);
sprintf(gfa_name, "%s.hic.tlb.bin", file_name);
FILE* fp = fopen(gfa_name, "w");
if (!fp) {
free(gfa_name);
@@ -481,7 +481,7 @@ int load_hc_pt_index(ha_ug_index** r_idx, char* file_name)
uint64_t flag = 0;
double index_time = yak_realtime();
char* gfa_name = (char*)malloc(strlen(file_name)+25);
sprintf(gfa_name, "%s.hc_tlb", file_name);
sprintf(gfa_name, "%s.hic.tlb.bin", file_name);
FILE* fp = fopen(gfa_name, "r");
if (!fp) {
free(gfa_name);
@@ -2142,6 +2142,7 @@ void destory_pdq(pdq* q)
{
kv_destroy(q->x);
kv_destroy(q->dis);
kv_destroy(q->vis);
}
void reset_pdq(pdq* q)
@@ -2889,7 +2890,7 @@ int load_hc_links(hc_links* link, const char *fn)
void write_hc_hits(kvec_pe_hit* hits, const char *fn)
{
char *buf = (char*)calloc(strlen(fn) + 25, 1);
sprintf(buf, "%s.hic.lk", fn);
sprintf(buf, "%s.hic.lk.bin", fn);
FILE* fp = fopen(buf, "w");
fwrite(&hits->a.n, sizeof(hits->a.n), 1, fp);
@@ -2903,7 +2904,7 @@ int load_hc_hits(kvec_pe_hit* hits, const char *fn)
{
uint64_t flag = 0;
char *buf = (char*)calloc(strlen(fn) + 25, 1);
sprintf(buf, "%s.hic.lk", fn);
sprintf(buf, "%s.hic.lk.bin", fn);
FILE* fp = NULL;
fp = fopen(buf, "r");
+15
View File
@@ -384,6 +384,21 @@ phased maternal/haplotype2 contig graph. This graph keeps the phased
maternal/haplotype2 assembly.
.RE
.PP
With Hi-C partition, hifiasm outputs the assembly graphs like trio partition,
but with additional prefix
.B [hic].
In this mode, hifiasm keeps Hi-C alignment results and Hi-C index in two bin
files:
.B *hic.lk.bin
and
.B *hic.tlb.bin.
Rerunning hifiasm with different Hi-C reads needs to delete these bin files.
.RE
.PP
For each graph, hifiasm also outputs a simplified version without sequences for
the ease of visualization. Hifiasm keeps corrected reads and overlaps in three