From 574b8304cfcc314adb615bb1fd4b159a59ab0441 Mon Sep 17 00:00:00 2001 From: David Edmondson Date: Thu, 25 Mar 2021 12:29:36 +0100 Subject: block/vdi: When writing new bmap entry fails, don't leak the buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Signed-off-by: David Edmondson Signed-off-by: Paolo Bonzini Acked-by: Max Reitz Message-id: 20210325112941.365238-2-pbonzini@redhat.com Message-Id: <20210309144015.557477-2-david.edmondson@oracle.com> Acked-by: Max Reitz Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- block/vdi.c | 1 + 1 file changed, 1 insertion(+) (limited to 'block') 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; } -- cgit v1.2.3