X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_cache.c;h=15113e02c2a804dbf4f75ba4ecd8ea23cd81ada8;hb=c1219a1c9db2e8400e2ee94b87f86ccd441485d5;hp=dc0ff0df27b33f21d5f3701c2d18648ae35a8ce6;hpb=813fadc54fbf0c9b948163851e9791a1ace716ae;p=collectd.git diff --git a/src/utils_cache.c b/src/utils_cache.c index dc0ff0df..15113e02 100644 --- a/src/utils_cache.c +++ b/src/utils_cache.c @@ -186,11 +186,13 @@ static int uc_insert (const data_set_t *ds, const value_list_t *vl, / CDTIME_T_TO_DOUBLE (vl->interval); ce->values_raw[i].absolute = vl->values[i].absolute; break; - + default: /* This shouldn't happen. */ ERROR ("uc_insert: Don't know how to handle data source type %i.", ds->ds[i].type); + sfree (key_copy); + cache_free (ce); return (-1); } /* switch (ds->ds[i].type) */ } /* for (i) */ @@ -636,12 +638,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); } @@ -689,7 +692,7 @@ int uc_set_state (const data_set_t *ds, const value_list_t *vl, int state) if (FORMAT_VL (name, sizeof (name), vl) != 0) { - ERROR ("uc_get_state: FORMAT_VL failed."); + ERROR ("uc_set_state: FORMAT_VL failed."); return (STATE_ERROR); } @@ -734,7 +737,6 @@ int uc_get_history_by_name (const char *name, if (ce->history_length < num_steps) { gauge_t *tmp; - size_t i; tmp = realloc (ce->history, sizeof (*ce->history) * num_steps * ce->values_num); @@ -798,7 +800,7 @@ int uc_get_hits (const data_set_t *ds, const value_list_t *vl) if (FORMAT_VL (name, sizeof (name), vl) != 0) { - ERROR ("uc_get_state: FORMAT_VL failed."); + ERROR ("uc_get_hits: FORMAT_VL failed."); return (STATE_ERROR); } @@ -823,7 +825,7 @@ int uc_set_hits (const data_set_t *ds, const value_list_t *vl, int hits) if (FORMAT_VL (name, sizeof (name), vl) != 0) { - ERROR ("uc_get_state: FORMAT_VL failed."); + ERROR ("uc_set_hits: FORMAT_VL failed."); return (STATE_ERROR); } @@ -849,7 +851,7 @@ int uc_inc_hits (const data_set_t *ds, const value_list_t *vl, int step) if (FORMAT_VL (name, sizeof (name), vl) != 0) { - ERROR ("uc_get_state: FORMAT_VL failed."); + ERROR ("uc_inc_hits: FORMAT_VL failed."); return (STATE_ERROR); }