]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libxl: Fix libvirtd crash on domain restore
authorJim Fehlig <jfehlig@suse.com>
Thu, 17 Feb 2022 18:48:13 +0000 (11:48 -0700)
committerJim Fehlig <jfehlig@suse.com>
Fri, 18 Feb 2022 18:20:21 +0000 (11:20 -0700)
Commit cc2a3c2a94 missed one case in the libxl driver where virDomainDef
is returned from libxlDomainSaveImageOpen and a g_steal_pointer is needed.
Without it, the virDomainDef object is freed and the driver crashes later
in the restore process when accessing the object.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libxl/libxl_domain.c

index c91e531a9ab8c42f5db2fa70d2bcadf144704067..ee031267ca74cd456c249f425b9df939d4daff60 100644 (file)
@@ -811,7 +811,7 @@ libxlDomainSaveImageOpen(libxlDriverPrivate *driver,
                                         VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
         goto error;
 
-    *ret_def = def;
+    *ret_def = g_steal_pointer(&def);
     *ret_hdr = hdr;
 
     return fd;