Skip to content

Commit

Permalink
fixed a few memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lh3 committed Apr 14, 2017
1 parent 9947c95 commit f35e152
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void mm_idx_destroy(mm_idx_t *mi)
}
for (i = 0; i < mi->n_seq; ++i)
free(mi->seq[i].name);
free(mi->seq); free(mi->B); free(mi);
free(mi->seq); free(mi->B); free(mi->S); free(mi);
}

const uint64_t *mm_idx_get(const mm_idx_t *mi, uint64_t minier, int *n)
Expand Down
4 changes: 2 additions & 2 deletions kalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void *krealloc(void *_km, void *ap, size_t n_bytes)
n_units = 1 + (n_bytes + sizeof(size_t) - 1) / sizeof(size_t);
p = (size_t*)ap - 1;
if (*p >= n_units) return ap;
q = kmalloc(km, n_bytes);
q = (size_t*)kmalloc(km, n_bytes);
if (q != ap) memcpy(q, ap, (*p - 1) * sizeof(size_t));
kfree(km, ap);
return q;
Expand Down Expand Up @@ -182,7 +182,7 @@ void *kmalloc(void *_km, size_t n_bytes)
void *kcalloc(void *_km, size_t count, size_t size)
{
kmem_t *km = (kmem_t*)_km;
char *p;
void *p;
if (size == 0 || count == 0) return 0;
if (km == 0) return calloc(count, size);
p = kmalloc(km, count * size);
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ int main(int argc, char *argv[])
/*
for (i = optind + 1; i < argc; ++i)
mm_map_file(mi, argv[i], &opt, n_threads, mini_batch_size);
mm_idx_destroy(mi);
*/
mm_idx_destroy(mi);
}
if (fpw) fclose(fpw);
if (fpr) fclose(fpr);
Expand Down
2 changes: 2 additions & 0 deletions sdust.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef SDUST_H
#define SDUST_H

#include <stdint.h>

struct sdust_buf_s;
typedef struct sdust_buf_s sdust_buf_t;

Expand Down

0 comments on commit f35e152

Please sign in to comment.