From 99991f81c6ee295259bb59dab1dee928bc8710ac Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Tue, 29 Jun 2010 16:26:22 -0700 Subject: [PATCH] Update to clean up test case. --- tests/include.am | 2 +- tests/mem_functions.c | 32 ++++++++------------------------ 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/tests/include.am b/tests/include.am index 3631a81e..08cf67e2 100644 --- a/tests/include.am +++ b/tests/include.am @@ -4,7 +4,7 @@ TESTS_LDADDS = libmemcached/libmemcached.la -VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes +VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --track-fds=yes DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb diff --git a/tests/mem_functions.c b/tests/mem_functions.c index ba555111..f59cf01a 100644 --- a/tests/mem_functions.c +++ b/tests/mem_functions.c @@ -5028,15 +5028,12 @@ static test_return_t memcached_get_MEMCACHED_ERRNO(memcached_st *memc) // See if memcached is reachable. value= memcached_get(tl_memc_h, key, strlen(key), &len, &flags, &rc); - if (value) - { - free(value); - test_true(value); // Pointer won't be zero so this is fine. - } - + test_false(value); test_true(len == 0); test_true(rc == MEMCACHED_ERRNO); + memcached_free(tl_memc_h); + return TEST_SUCCESS; } @@ -5054,12 +5051,7 @@ static test_return_t memcached_get_MEMCACHED_NOTFOUND(memcached_st *memc) // See if memcached is reachable. value= memcached_get(memc, key, strlen(key), &len, &flags, &rc); - if (value) - { - free(value); - test_true(value); // Pointer won't be zero so this is fine. - } - + test_false(value); test_true(len == 0); test_true(rc == MEMCACHED_NOTFOUND); @@ -5093,15 +5085,12 @@ static test_return_t memcached_get_by_key_MEMCACHED_ERRNO(memcached_st *memc) // See if memcached is reachable. value= memcached_get_by_key(tl_memc_h, key, strlen(key), key, strlen(key), &len, &flags, &rc); - if (value) - { - free(value); - test_true(value); // Pointer won't be zero so this is fine. - } - + test_false(value); test_true(len == 0); test_true(rc == MEMCACHED_ERRNO); + memcached_free(tl_memc_h); + return TEST_SUCCESS; } @@ -5119,12 +5108,7 @@ static test_return_t memcached_get_by_key_MEMCACHED_NOTFOUND(memcached_st *memc) // See if memcached is reachable. value= memcached_get_by_key(memc, key, strlen(key), key, strlen(key), &len, &flags, &rc); - if (value) - { - free(value); - test_true(value); // Pointer won't be zero so this is fine. - } - + test_false(value); test_true(len == 0); test_true(rc == MEMCACHED_NOTFOUND); -- 2.30.2