From: Max Reitz <mre...@redhat.com>

All error paths after a successful bdrv_open() of target_bs should
contain a bdrv_unref(target_bs). This one did not yet, so add it.

Signed-off-by: Max Reitz <mre...@redhat.com>
Reviewed-by: Alberto Garcia <be...@igalia.com>
Reviewed-by: Kevin Wolf <kw...@redhat.com>
Reviewed-by: Fam Zheng <f...@redhat.com>
Signed-off-by: Kevin Wolf <kw...@redhat.com>
---
 blockdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/blockdev.c b/blockdev.c
index 917ae06..07c1741 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3171,6 +3171,7 @@ static void do_drive_backup(const char *device, const 
char *target,
         bmap = bdrv_find_dirty_bitmap(bs, bitmap);
         if (!bmap) {
             error_setg(errp, "Bitmap '%s' could not be found", bitmap);
+            bdrv_unref(target_bs);
             goto out;
         }
     }
-- 
1.8.3.1


Reply via email to