aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2016-06-15 19:27:14 +0200
committerMarkus Armbruster <armbru@redhat.com>2016-06-20 16:38:14 +0200
commit2ec62faea274aabb2feaad2b8f85961161b5e1e4 (patch)
tree3c695018d4902d19d15b3d008bedbf375941d4d6 /util
parent9be385980d37e8f4fd33f605f5fb1c3d144170a8 (diff)
log: Plug memory leak on multiple -dfilter
-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> Message-Id: <1466011636-6112-2-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/log.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/util/log.c b/util/log.c
index 5ad72c197f..6f45e0a26c 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) {