Just clean up a call (use the previous method).
[awesomized/libmemcached] / tests / mem_functions.c
index bb2885075c2aa720d16f2a41db6ad1aa260d1e60..815f77b73036009fd6b85358f68e00a922be0fb8 100644 (file)
@@ -190,6 +190,7 @@ static test_return_t memcached_server_remove_test(memcached_st *ptr __attribute_
   servers= memcached_servers_parse(server_string);
 
   rc= memcached_server_push(memc, servers);
+  memcached_server_list_free(servers);
 
   callbacks[0]= server_print_callback;
   memcached_server_cursor(memc, callbacks, NULL,  1);
@@ -2729,6 +2730,8 @@ static test_return_t user_supplied_bug19(memcached_st *not_used)
 
   server= memcached_server_by_key(memc, "a", 1, &res);
 
+  memcached_free(memc);
+
   return TEST_SUCCESS;
 }
 
@@ -4487,7 +4490,7 @@ static test_return_t replication_randomize_mget_test(memcached_st *memc)
   const char *keys[]= { "key1", "key2", "key3", "key4", "key5", "key6", "key7" };
   size_t len[]= { 4, 4, 4, 4, 4, 4, 4 };
 
-  for (int x=0; x< 7; ++x)
+  for (size_t x= 0; x< 7; ++x)
   {
     rc= memcached_set(memc, keys[x], len[x], "1", 1, 0, 0);
     test_true(rc == MEMCACHED_SUCCESS);
@@ -4796,7 +4799,8 @@ static test_return_t memcached_get_hashkit_test (memcached_st *memc)
 {
   uint32_t x;
   const char **ptr;
-  hashkit_st *kit;
+  const hashkit_st *kit;
+  hashkit_st new_kit;
   hashkit_return_t hash_rc;
 
   uint32_t md5_hosts[]= {4U, 1U, 0U, 1U, 4U, 2U, 0U, 3U, 0U, 0U, 3U, 1U, 0U, 0U, 1U, 3U, 0U, 0U, 0U, 3U, 1U, 0U, 4U, 4U, 3U};
@@ -4804,9 +4808,12 @@ static test_return_t memcached_get_hashkit_test (memcached_st *memc)
 
   kit= memcached_get_hashkit(memc);
 
-  hash_rc= hashkit_set_custom_function(kit, hash_md5_test_function, NULL);
+  hashkit_clone(&new_kit, kit);
+  hash_rc= hashkit_set_custom_function(&new_kit, hash_md5_test_function, NULL);
   test_true(hash_rc == HASHKIT_SUCCESS);
 
+  memcached_set_hashkit(memc, &new_kit);
+
   /*
     Verify Setting the hash.
   */
@@ -4830,9 +4837,11 @@ static test_return_t memcached_get_hashkit_test (memcached_st *memc)
     test_true(md5_hosts[x] == hash_val);
   }
 
-  hash_rc= hashkit_set_custom_function(kit, hash_crc_test_function, NULL);
+  hash_rc= hashkit_set_custom_function(&new_kit, hash_crc_test_function, NULL);
   test_true(hash_rc == HASHKIT_SUCCESS);
 
+  memcached_set_hashkit(memc, &new_kit);
+
   /*
     Verify Setting the hash.
   */