[pve-devel] [PATCH v2 qemu 2/3] vma: create: avoid triggering assertion in error case

Fabian Ebner f.ebner at proxmox.com
Wed Jun 22 10:45:12 CEST 2022


error_setg expects its argument to not be initialized yet.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

New in v2.

 vma-writer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/vma-writer.c b/vma-writer.c
index 11d8321ffd..29567cba68 100644
--- a/vma-writer.c
+++ b/vma-writer.c
@@ -310,6 +310,8 @@ VmaWriter *vma_writer_create(const char *filename, uuid_t uuid, Error **errp)
         }
 
         if (vmaw->fd < 0) {
+            error_free(*errp);
+            *errp = NULL;
             error_setg(errp, "can't open file %s - %s\n", filename,
                        g_strerror(errno));
             goto err;
-- 
2.30.2






More information about the pve-devel mailing list