]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libxl: Don't free def member of virDomainObj
authorJim Fehlig <jfehlig@suse.com>
Thu, 24 Sep 2020 16:39:13 +0000 (10:39 -0600)
committerJim Fehlig <jfehlig@suse.com>
Thu, 24 Sep 2020 21:02:31 +0000 (15:02 -0600)
The refactoring in commit de49d5bad3 accidentally dropped the statement
setting def to NULL after successfully adding it to the virDomainObjList,
causing it to be freed while still in use. The resulting memory
corruption caused unpredictable behavior, often resulting in a libvirtd
crash.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
src/libxl/libxl_driver.c

index 083738871de6697b2814f43ef3edc3ce072acd32..571b70f98246644f50dfd8183b045e49396c432c 100644 (file)
@@ -627,6 +627,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
                                        NULL)))
             goto cleanup;
 
+        def = NULL;
         vm->persistent = 1;
         virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
     }