26ba25
From 2bbbfcc52eb4c82714a8570fe217d80354687186 Mon Sep 17 00:00:00 2001
26ba25
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
26ba25
Date: Wed, 1 Aug 2018 13:55:15 +0100
26ba25
Subject: [PATCH 11/21] migration/block-dirty-bitmap: fix memory leak in
26ba25
 dirty_bitmap_load_bits
26ba25
26ba25
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
26ba25
Message-id: <20180801135522.11658-12-dgilbert@redhat.com>
26ba25
Patchwork-id: 81567
26ba25
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 11/18] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits
26ba25
Bugzilla: 1594384
26ba25
RH-Acked-by: Peter Xu <peterx@redhat.com>
26ba25
RH-Acked-by: John Snow <jsnow@redhat.com>
26ba25
RH-Acked-by: Juan Quintela <quintela@redhat.com>
26ba25
26ba25
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
26ba25
26ba25
Release buf on error path too.
26ba25
26ba25
Bug was introduced in b35ebdf076d697bc "migration: add postcopy
26ba25
migration of dirty bitmaps" with the whole function.
26ba25
26ba25
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
26ba25
Message-Id: <20180427142002.21930-3-vsementsov@virtuozzo.com>
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
CC: qemu-stable@nongnu.org
26ba25
Signed-off-by: Eric Blake <eblake@redhat.com>
26ba25
(cherry picked from commit 16a2227893dc1d5cad78ed376ad1d7e300978fbe)
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 migration/block-dirty-bitmap.c | 1 +
26ba25
 1 file changed, 1 insertion(+)
26ba25
26ba25
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
26ba25
index abba0b6..b3b31ba 100644
26ba25
--- a/migration/block-dirty-bitmap.c
26ba25
+++ b/migration/block-dirty-bitmap.c
26ba25
@@ -600,6 +600,7 @@ static int dirty_bitmap_load_bits(QEMUFile *f, DirtyBitmapLoadState *s)
26ba25
         ret = qemu_get_buffer(f, buf, buf_size);
26ba25
         if (ret != buf_size) {
26ba25
             error_report("Failed to read bitmap bits");
26ba25
+            g_free(buf);
26ba25
             return -EIO;
26ba25
         }
26ba25
 
26ba25
-- 
26ba25
1.8.3.1
26ba25