block/accounting.c | 7 +++++++ 1 file changed, 7 insertions(+)
The block_acct_cleanup method failed to release memory associated
with block histograms.
Fixes: b741ae7417 (block/accounting: introduce latency histogram)
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
block/accounting.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/block/accounting.c b/block/accounting.c
index 038af370170..40ed70782b4 100644
--- a/block/accounting.c
+++ b/block/accounting.c
@@ -80,6 +80,13 @@ bool block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
void block_acct_cleanup(BlockAcctStats *stats)
{
BlockAcctTimedStats *s, *next;
+ size_t i;
+ for (i = 0; i < BLOCK_MAX_IOTYPE; i++) {
+ BlockLatencyHistogram *hist = &stats->latency_histogram[i];
+ g_free(hist->bins);
+ g_free(hist->boundaries);
+ }
+
QSLIST_FOREACH_SAFE(s, &stats->intervals, entries, next) {
g_free(s);
}
--
2.56.0
On Mon, Oct 12, 2026 at 12:43:59PM +0100, Daniel P. Berrangé wrote:
> The block_acct_cleanup method failed to release memory associated
> with block histograms.
>
> Fixes: b741ae7417 (block/accounting: introduce latency histogram)
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> block/accounting.c | 7 +++++++
> 1 file changed, 7 insertions(+)
Reviewed-by: Eric Blake <eblake@redhat.com>
>
> diff --git a/block/accounting.c b/block/accounting.c
> index 038af370170..40ed70782b4 100644
> --- a/block/accounting.c
> +++ b/block/accounting.c
> @@ -80,6 +80,13 @@ bool block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
> void block_acct_cleanup(BlockAcctStats *stats)
> {
> BlockAcctTimedStats *s, *next;
> + size_t i;
> + for (i = 0; i < BLOCK_MAX_IOTYPE; i++) {
> + BlockLatencyHistogram *hist = &stats->latency_histogram[i];
> + g_free(hist->bins);
> + g_free(hist->boundaries);
> + }
> +
> QSLIST_FOREACH_SAFE(s, &stats->intervals, entries, next) {
> g_free(s);
> }
> --
> 2.56.0
>
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
© 2016 - 2026 Red Hat, Inc.