X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_cache.c;h=dc0ff0df27b33f21d5f3701c2d18648ae35a8ce6;hb=813fadc54fbf0c9b948163851e9791a1ace716ae;hp=e77f9942c8ffe5273f55744e53a2513e5df22a77;hpb=0c62bc40d4058f95dc6f3eff9da32befe4925751;p=collectd.git diff --git a/src/utils_cache.c b/src/utils_cache.c index e77f9942..dc0ff0df 100644 --- a/src/utils_cache.c +++ b/src/utils_cache.c @@ -296,7 +296,13 @@ int uc_check_timeout (void) 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, @@ -643,6 +649,8 @@ int uc_get_names (char ***ret_names, cdtime_t **ret_times, size_t *ret_number) *ret_names = names; if (ret_times != NULL) *ret_times = times; + else + sfree (times); *ret_number = number; return (0);