X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Futils_cache.c;h=7eae1c7ed5121e6cb01f15f10336392911ade236;hb=d404a0c4f97ef047c2add2e27f2424f01bc45ad7;hp=fa6e6603ec3e10eedcdc6ea7d56ab64a0b04db6e;hpb=1126617bebe569dffe6b7a5d3f0c400134b41d65;p=collectd.git diff --git a/src/utils_cache.c b/src/utils_cache.c index fa6e6603..7eae1c7e 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, @@ -315,7 +321,6 @@ int uc_check_timeout (void) if (status != 0) { ERROR ("uc_check_timeout: parse_identifier_vl (\"%s\") failed.", keys[i]); - cache_free (ce); continue; } @@ -631,12 +636,13 @@ int uc_get_names (char ***ret_names, cdtime_t **ret_times, size_t *ret_number) if (status != 0) { size_t i; - + for (i = 0; i < number; i++) { sfree (names[i]); } sfree (names); + sfree (times); return (-1); } @@ -644,6 +650,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);