diff --git a/chain.c b/chain.c index 6ecd6ed..ba5ae5f 100644 --- a/chain.c +++ b/chain.c @@ -63,7 +63,10 @@ int mm_chain_dp(int max_dist, int bw, int max_skip, int min_sc, int n, mm128_t * for (i = n_u = 0; i < n; ++i) if (t[i] == 0 && f[i] >= min_sc) ++n_u; - if (n_u == 0) return 0; + if (n_u == 0) { + kfree(km, f); kfree(km, p); kfree(km, t); + return 0; + } u = (uint64_t*)kmalloc(km, n_u * 8); for (i = n_u = 0; i < n; ++i) if (t[i] == 0 && f[i] >= min_sc) @@ -100,7 +103,7 @@ int mm_chain_dp(int max_dist, int bw, int max_skip, int min_sc, int n, mm128_t * kfree(km, f); kfree(km, p); kfree(km, t); // write the result to _a_ - b = kmalloc(km, n_v * sizeof(mm128_t)); + b = (mm128_t*)kmalloc(km, n_v * sizeof(mm128_t)); for (i = 0, k = 0; i < n_u; ++i) for (j = 0; j < (int32_t)u[i]; ++j) b[k] = a[v[k]], ++k; diff --git a/map.c b/map.c index e41141b..6d8d761 100644 --- a/map.c +++ b/map.c @@ -60,6 +60,8 @@ mm_tbuf_t *mm_tbuf_init(void) void mm_tbuf_destroy(mm_tbuf_t *b) { if (b == 0) return; + kfree(b->km, b->mini.a); + sdust_buf_destroy(b->sdb); km_destroy(b->km_fixed); km_destroy(b->km); free(b); diff --git a/sdust.c b/sdust.c index 55d7f21..07339dd 100644 --- a/sdust.c +++ b/sdust.c @@ -62,6 +62,7 @@ sdust_buf_t *sdust_buf_init(void *km) void sdust_buf_destroy(sdust_buf_t *buf) { if (buf == 0) return; + kdq_destroy(int, buf->w); kfree(buf->km, buf->P.a); kfree(buf->km, buf->res.a); kfree(buf->km, buf); }