From b03c385c6eee5999f6aadcc516aa0f9fc882df47 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Fri, 22 Jun 2018 18:59:58 +0200 Subject: [PATCH 19/57] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits RH-Author: Dr. David Alan Gilbert Message-id: <20180622190005.21297-12-dgilbert@redhat.com> Patchwork-id: 81009 O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 11/18] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits Bugzilla: 1584139 RH-Acked-by: Peter Xu RH-Acked-by: Juan Quintela RH-Acked-by: Laurent Vivier From: Vladimir Sementsov-Ogievskiy Release buf on error path too. Bug was introduced in b35ebdf076d697bc "migration: add postcopy migration of dirty bitmaps" with the whole function. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20180427142002.21930-3-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake (cherry picked from commit 16a2227893dc1d5cad78ed376ad1d7e300978fbe) Signed-off-by: Miroslav Rezanina --- migration/block-dirty-bitmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index dd04f10..8819aab 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -600,6 +600,7 @@ static int dirty_bitmap_load_bits(QEMUFile *f, DirtyBitmapLoadState *s) ret = qemu_get_buffer(f, buf, buf_size); if (ret != buf_size) { error_report("Failed to read bitmap bits"); + g_free(buf); return -EIO; } -- 1.8.3.1