Removed issue around zero length returns now being valid. Fixed memory leak
[m6w6/libmemcached] / tests / function.c
index 777be74ca0fd375573eea5292d651d8b6d075bdb..a08e1eaabbf569f333e1c7ca3f44b8056f3c012c 100644 (file)
@@ -117,6 +117,7 @@ uint8_t server_unsort_test(memcached_st *ptr)
 {
   uint8_t x;
   uint32_t counter= 0; /* Prime the value for the assert in server_display_function */
+  uint32_t bigger= 0; /* Prime the value for the assert in server_display_function */
   memcached_return rc;
   memcached_server_function callbacks[1];
   memcached_st *local_memc;
@@ -136,6 +137,11 @@ uint8_t server_unsort_test(memcached_st *ptr)
   callbacks[0]= server_display_unsort_function;
   memcached_server_cursor(local_memc, callbacks, (void *)&counter,  1);
 
+  /* Now we sort old data! */
+  memcached_behavior_set(local_memc, MEMCACHED_BEHAVIOR_SORT_HOSTS, 1);
+  callbacks[0]= server_display_function;
+  memcached_server_cursor(local_memc, callbacks, (void *)&bigger,  1);
+
 
   memcached_free(local_memc);
 
@@ -614,6 +620,7 @@ uint8_t read_through(memcached_st *memc)
   assert(rc == MEMCACHED_SUCCESS);
   assert(string_length ==  strlen(READ_THROUGH_VALUE));
   assert(!strcmp(READ_THROUGH_VALUE, string));
+  free(string);
 
   string= memcached_get(memc, key, strlen(key),
                         &string_length, &flags, &rc);
@@ -621,6 +628,7 @@ uint8_t read_through(memcached_st *memc)
   assert(rc == MEMCACHED_SUCCESS);
   assert(string_length ==  strlen(READ_THROUGH_VALUE));
   assert(!strcmp(READ_THROUGH_VALUE, string));
+  free(string);
 
   return 0;
 }
@@ -1944,8 +1952,6 @@ uint8_t user_supplied_bug14(memcached_st *memc)
                           &string_length, &flags, &rc);
 
     assert(rc == MEMCACHED_SUCCESS);
-    if (current_length > 0)
-      assert(string);
     assert(string_length == current_length);
     assert(!memcmp(string, value, string_length));