diff --git a/include/villas/stats.h b/include/villas/stats.h index 0741d48b8..f72ae9fd8 100644 --- a/include/villas/stats.h +++ b/include/villas/stats.h @@ -67,7 +67,7 @@ struct stats { int stats_init(struct stats *s, int buckets, int warmup); -void stats_destroy(struct stats *s); +int stats_destroy(struct stats *s); void stats_update(struct stats_delta *s, enum stats_id id, double val); diff --git a/lib/hooks/stats_collect.c b/lib/hooks/stats_collect.c index 0c3309093..dd3ed94e9 100644 --- a/lib/hooks/stats_collect.c +++ b/lib/hooks/stats_collect.c @@ -67,9 +67,7 @@ static int stats_collect_destroy(struct hook *h) { struct stats_collect *p = h->_vd; - stats_destroy(&p->stats); - - return 0; + return stats_destroy(&p->stats); } static int stats_collect_start(struct hook *h) diff --git a/lib/stats.c b/lib/stats.c index c4c0d8396..de0b2005a 100644 --- a/lib/stats.c +++ b/lib/stats.c @@ -52,13 +52,14 @@ int stats_init(struct stats *s, int buckets, int warmup) return 0; } -void stats_destroy(struct stats *s) +int stats_destroy(struct stats *s) { - for (int i = 0; i < STATS_COUNT; i++) { + for (int i = 0; i < STATS_COUNT; i++) hist_destroy(&s->histograms[i]); - } free(s->delta); + + return 0; } void stats_update(struct stats_delta *d, enum stats_id id, double val)