summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorDavid Edmondson2021-03-25 12:29:36 +0100
committerStefan Hajnoczi2021-03-31 11:44:21 +0200
commit574b8304cfcc314adb615bb1fd4b159a59ab0441 (patch)
tree00665e1a7745234dcd01dcb64d36de1b18e0a348 /block
parentUpdate version for v6.0.0-rc1 release (diff)
downloadqemu-574b8304cfcc314adb615bb1fd4b159a59ab0441.tar.gz
qemu-574b8304cfcc314adb615bb1fd4b159a59ab0441.tar.xz
qemu-574b8304cfcc314adb615bb1fd4b159a59ab0441.zip
block/vdi: When writing new bmap entry fails, don't leak the buffer
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é <philmd@redhat.com> Signed-off-by: David Edmondson <david.edmondson@oracle.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Max Reitz <mreitz@redhat.com> Message-id: 20210325112941.365238-2-pbonzini@redhat.com Message-Id: <20210309144015.557477-2-david.edmondson@oracle.com> Acked-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/vdi.c1
1 files changed, 1 insertions, 0 deletions
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;
}