]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libxl: fix crash when initializing driver
authorJim Fehlig <jfehlig@suse.com>
Fri, 3 Apr 2020 21:51:48 +0000 (15:51 -0600)
committerJim Fehlig <jfehlig@suse.com>
Mon, 6 Apr 2020 14:23:01 +0000 (08:23 -0600)
Commit 54a401af478 split out DriverConfigInit from DriverConfigNew, but
then called it a bit late from libxlStateInitialize. The cfg is used in
libxlDriverConfigLoadFile and when uninitialized results in a crash.
Calling DriverConfigInit immediately after DriverConfigNew fixes the
crash.

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

index 7ec4fcc3d17e6fe93c8cd34237b2f2172efe56a2..980984b199008f0861cfaff0d1572d4d64a38455 100644 (file)
@@ -702,14 +702,14 @@ libxlStateInitialize(bool privileged,
     if (!(cfg = libxlDriverConfigNew()))
         goto error;
 
+    if (libxlDriverConfigInit(cfg) < 0)
+        goto error;
+
     driverConf = g_strdup_printf("%s/libxl.conf", cfg->configBaseDir);
 
     if (libxlDriverConfigLoadFile(cfg, driverConf) < 0)
         goto error;
 
-    if (libxlDriverConfigInit(cfg) < 0)
-        goto error;
-
     /* Register the callbacks providing access to libvirt's event loop */
     libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx);