qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH 1/3] log: Plug memory leak on multiple -dfilter
Date: Wed, 15 Jun 2016 19:27:14 +0200	[thread overview]
Message-ID: <1466011636-6112-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1466011636-6112-1-git-send-email-armbru@redhat.com>

-dfilter overwrites any previous filter.  The overwritten filter is
leaked.  Leaks since the beginning (commit 3514552, v2.6.0).  Free it
properly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 util/log.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/util/log.c b/util/log.c
index 5ad72c1..6f45e0a 100644
--- a/util/log.c
+++ b/util/log.c
@@ -145,9 +145,16 @@ bool qemu_log_in_addr_range(uint64_t addr)
 void qemu_set_dfilter_ranges(const char *filter_spec)
 {
     gchar **ranges = g_strsplit(filter_spec, ",", 0);
+
+    if (debug_regions) {
+        g_array_unref(debug_regions);
+        debug_regions = NULL;
+    }
+
     if (ranges) {
         gchar **next = ranges;
         gchar *r = *next++;
+
         debug_regions = g_array_sized_new(FALSE, FALSE,
                                           sizeof(Range), g_strv_length(ranges));
         while (r) {
-- 
2.5.5

  reply	other threads:[~2016-06-15 17:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 17:27 [Qemu-devel] [PATCH 0/3] log: Fix error handling and a memory leak Markus Armbruster
2016-06-15 17:27 ` Markus Armbruster [this message]
2016-06-15 18:42   ` [Qemu-devel] [PATCH 1/3] log: Plug memory leak on multiple -dfilter Eric Blake
2016-06-15 17:27 ` [Qemu-devel] [PATCH 2/3] log: Fix qemu_set_dfilter_ranges() error reporting Markus Armbruster
2016-06-15 19:06   ` Eric Blake
2016-06-16  7:40     ` Markus Armbruster
2016-06-15 17:27 ` [Qemu-devel] [PATCH 3/3] log: Fix qemu_set_log_filename() error handling Markus Armbruster
2016-06-15 19:11   ` 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=1466011636-6112-2-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).