diff --git a/lib/device/bcache.c b/lib/device/bcache.c index 557c8b10e..6e86039ab 100644 --- a/lib/device/bcache.c +++ b/lib/device/bcache.c @@ -34,8 +34,8 @@ #define SECTOR_SHIFT 9L #define FD_TABLE_INC 1024 -static int _fd_table_size; -static int *_fd_table; +static int _fd_table_size = 0; +static int *_fd_table = NULL; //---------------------------------------------------------------- diff --git a/test/unit/io_engine_t.c b/test/unit/io_engine_t.c index 2f6ea5b03..99610c15f 100644 --- a/test/unit/io_engine_t.c +++ b/test/unit/io_engine_t.c @@ -107,7 +107,6 @@ static void _fix_exit(void *fixture) if (f) { (void) close(f->fd); - bcache_clear_fd(f->di); (void) unlink(f->fname); free(f->data); if (f->e) @@ -157,6 +156,9 @@ static void _test_read(void *fixture) T_ASSERT(!io.error); _check_buffer(f->data, 123, SECTOR_SIZE * BLOCK_SIZE_SECTORS); + + bcache_destroy(cache); + f->e = NULL; // already destroyed } static void _test_write(void *fixture) @@ -175,6 +177,9 @@ static void _test_write(void *fixture) T_ASSERT(f->e->wait(f->e, _complete_io)); T_ASSERT(io.completed); T_ASSERT(!io.error); + + bcache_destroy(cache); + f->e = NULL; // already destroyed } static void _test_write_bytes(void *fixture) diff --git a/test/unit/vdo_t.c b/test/unit/vdo_t.c index 27ad26bc7..c151edafa 100644 --- a/test/unit/vdo_t.c +++ b/test/unit/vdo_t.c @@ -99,6 +99,7 @@ static void _check_good(struct example_good *es, unsigned count) fprintf(stderr, "\n"); #endif T_ASSERT(_status_eq(&e->status, pr.status)); + free(pr.status->device); free(pr.status); } }