From: David Edmondson <david.edmond...@oracle.com>

If a new bitmap entry is allocated, requiring the entire block to be
written, avoiding leaking the buffer allocated for the block should
the write fail.

Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com>
Signed-off-by: David Edmondson <david.edmond...@oracle.com>
Message-Id: <20210309144015.557477-2-david.edmond...@oracle.com>
Acked-by: Max Reitz <mre...@redhat.com>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
 block/vdi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/vdi.c b/block/vdi.c
index 5627e7d764..2a6dc26124 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -690,6 +690,7 @@ nonallocating_write:
 
     logout("finished data write\n");
     if (ret < 0) {
+        g_free(block);
         return ret;
     }
 
-- 
2.29.2



Reply via email to