X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fdaemon%2Futils_cache.c;h=76213955ca168dc17c9b01833b15fdd5afe3c517;hb=8c864f5e634118fce2446ebbba96a1cb7ec39dda;hp=fe22f211bceafac758ad5734672526cc86df640c;hpb=a7eecf6018a684dcf8323d4a41a7e704a5d57f02;p=collectd.git diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index fe22f211..76213955 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -198,6 +198,7 @@ static int uc_insert (const data_set_t *ds, const value_list_t *vl, /* 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) */ @@ -303,7 +304,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, @@ -322,7 +329,6 @@ int uc_check_timeout (void) if (status != 0) { ERROR ("uc_check_timeout: parse_identifier_vl (\"%s\") failed.", keys[i]); - cache_free (ce); continue; } @@ -648,12 +654,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); } @@ -661,6 +668,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);