All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	qemu-block@nongnu.org, "Hanna Reitz" <hreitz@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH] block: fix leak of block histogram data
Date: Mon, 12 Oct 2026 12:43:59 +0100	[thread overview]
Message-ID: <20261012114400.206772-1-berrange@redhat.com> (raw)

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



             reply	other threads:[~2026-10-12 11:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 11:43 Daniel P. Berrangé [this message]
2026-10-13 18:58 ` [PATCH] block: fix leak of block histogram data Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261012114400.206772-1-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.