/* This shouldn't happen. */
ERROR ("uc_insert: Don't know how to handle data source type %i.",
ds->ds[i].type);
+ sfree (key_copy);
return (-1);
} /* switch (ds->ds[i].type) */
} /* for (i) */
pthread_mutex_unlock (&cache_lock);
if (keys_len == 0)
+ {
+ /* realloc() may have been called for these. */
+ sfree (keys);
+ sfree (keys_time);
+ sfree (keys_interval);
return (0);
+ }
/* Call the "missing" callback for each value. Do this before removing the
* value from the cache, so that callbacks can still access the data stored,
if (status != 0)
{
ERROR ("uc_check_timeout: parse_identifier_vl (\"%s\") failed.", keys[i]);
- cache_free (ce);
continue;
}
size_t number = 0;
size_t size_arrays = 0;
- /* Increment size for the 2 arrays of values
- * Because realloc is time consuming, it's better to
- * realloc by blocks and not by units.
- * To see the difference, set this value to 1.
- *
- * To change this value at compile time:
- * ./configure CPPFLAGS="-DLISTVAL_INCREASE=102400"
- */
-#ifndef LISTVAL_INCREASE
-# define LISTVAL_INCREASE 1024
-#endif
-
int status = 0;
if ((ret_names == NULL) || (ret_number == NULL))
{
/* Handle the "no values" case here, to avoid the error message when
* calloc() returns NULL. */
- pthread_mutex_lock (&cache_lock);
+ pthread_mutex_unlock (&cache_lock);
return (0);
}
ERROR ("uc_get_names: calloc failed.");
sfree (names);
sfree (times);
- pthread_mutex_lock (&cache_lock);
+ pthread_mutex_unlock (&cache_lock);
return (ENOMEM);
}
if (status != 0)
{
size_t i;
-
+
for (i = 0; i < number; i++)
{
sfree (names[i]);
}
sfree (names);
+ sfree (times);
return (-1);
}
*ret_names = names;
if (ret_times != NULL)
*ret_times = times;
+ else
+ sfree (times);
*ret_number = number;
return (0);