mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
cov: test for fixture being NULL pointer
Explicit check for teoretical NULL pointer passed as fixture.
This commit is contained in:
parent
3f946bfce7
commit
9721f3e0ff
@ -349,10 +349,12 @@ static struct fixture *_fixture_init(sector_t block_size, unsigned nr_cache_bloc
|
||||
|
||||
static void _fixture_exit(struct fixture *f)
|
||||
{
|
||||
_expect(f->me, E_DESTROY);
|
||||
bcache_destroy(f->cache);
|
||||
if (f) {
|
||||
_expect(f->me, E_DESTROY);
|
||||
bcache_destroy(f->cache);
|
||||
|
||||
free(f);
|
||||
free(f);
|
||||
}
|
||||
}
|
||||
|
||||
static void *_small_fixture_init(void)
|
||||
|
@ -109,11 +109,13 @@ static void _fix_exit(void *fixture)
|
||||
{
|
||||
struct fixture *f = fixture;
|
||||
|
||||
bcache_destroy(f->cache);
|
||||
close(f->fd);
|
||||
bcache_clear_fd(f->di);
|
||||
unlink(f->fname);
|
||||
free(f);
|
||||
if (f) {
|
||||
bcache_destroy(f->cache);
|
||||
(void) close(f->fd);
|
||||
bcache_clear_fd(f->di);
|
||||
(void) unlink(f->fname);
|
||||
free(f);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
@ -31,7 +31,8 @@ static void *_mem_init(void) {
|
||||
|
||||
static void _mem_exit(void *mem)
|
||||
{
|
||||
dm_pool_destroy(mem);
|
||||
if (mem)
|
||||
dm_pool_destroy(mem);
|
||||
}
|
||||
|
||||
static void test_get_next(void *fixture)
|
||||
|
@ -104,13 +104,15 @@ static void _fix_exit(void *fixture)
|
||||
{
|
||||
struct fixture *f = fixture;
|
||||
|
||||
close(f->fd);
|
||||
bcache_clear_fd(f->di);
|
||||
unlink(f->fname);
|
||||
free(f->data);
|
||||
if (f->e)
|
||||
f->e->destroy(f->e);
|
||||
free(f);
|
||||
if (f) {
|
||||
(void) close(f->fd);
|
||||
bcache_clear_fd(f->di);
|
||||
(void) unlink(f->fname);
|
||||
free(f->data);
|
||||
if (f->e)
|
||||
f->e->destroy(f->e);
|
||||
free(f);
|
||||
}
|
||||
}
|
||||
|
||||
static void _test_create(void *fixture)
|
||||
|
@ -28,7 +28,8 @@ static void *rt_init(void)
|
||||
|
||||
static void rt_exit(void *fixture)
|
||||
{
|
||||
radix_tree_destroy(fixture);
|
||||
if (fixture)
|
||||
radix_tree_destroy(fixture);
|
||||
}
|
||||
|
||||
static void test_create_destroy(void *fixture)
|
||||
|
Loading…
Reference in New Issue
Block a user